Browse Source

dovomin profile edit completed

confirmation-email
Milad Karbasizadeh 11 years ago
parent
commit
809cb34bf9
7 changed files with 40 additions and 18 deletions
  1. +1
    -1
      Sevomin.Models/Repositories/JobRepository.cs
  2. +14
    -4
      Sevomin.WebFrontend.Controllers/AccountController.cs
  3. +3
    -1
      Sevomin.WebFrontend.Controllers/JobController.cs
  4. +2
    -0
      Sevomin.WebFrontend/Sevomin.WebFrontend.csproj
  5. +15
    -7
      Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml
  6. +4
    -4
      Sevomin.WebFrontend/Views/Shared/DovominParameterViewModel.cshtml
  7. +1
    -1
      Sevomin.WebFrontend/Views/Shared/JobParameterViewModel.cshtml

+ 1
- 1
Sevomin.Models/Repositories/JobRepository.cs View File

@ -78,7 +78,7 @@ namespace Sevomin.Models.Repositories
job.IsFullTime = true;
job.ShowCompanyLogo = false;
job.ShowCompanyName = false;
job.Avalin = avalin;
job.Avalin = avalin;
avalin.Jobs.Add(job);
return job;
}


+ 14
- 4
Sevomin.WebFrontend.Controllers/AccountController.cs View File

@ -160,7 +160,7 @@ namespace Sevomin.WebFrontend.Controllers
[HttpPost]
public async Task<ActionResult> ProfileDovomin(string JalaliBirthDate, string FirstName,
string LastName, string ContactPersonEMail, bool IsFullTime,
bool IsPartTime, string Description, FormCollection form)
bool IsPartTime, string Description, HttpPostedFileBase EnglishResume, HttpPostedFileBase PersianResume, FormCollection form)
{
User u = await UserManager.FindByNameAsync(User.Identity.Name);
if (u == null || !(u is Dovomin))
@ -182,6 +182,17 @@ namespace Sevomin.WebFrontend.Controllers
string value = form[string.Format("value-{0}", jp.Parameter.Id)];
jp.SetValue(value);
}
if (EnglishResume != null)
{
dovomin.EnglishResume = string.Format("{0}-resume-en{2}", User.Identity.Name, "", System.IO.Path.GetExtension(EnglishResume.FileName));
EnglishResume.SaveAs(System.IO.Path.Combine(Server.MapPath("~/App_Data/resumes"), dovomin.EnglishResume));
}
if (PersianResume != null)
{
dovomin.PersianResume = string.Format("{0}-resume-fa{2}", User.Identity.Name, "", System.IO.Path.GetExtension(PersianResume.FileName));
PersianResume.SaveAs(System.IO.Path.Combine(Server.MapPath("~/App_Data/resumes"), dovomin.PersianResume));
}
SevominDbContext.Current.SaveChanges();
}
@ -189,9 +200,8 @@ namespace Sevomin.WebFrontend.Controllers
{
throw;
}
DovominViewModel dvm = new DovominViewModel(u as Dovomin);
return View("ProfileDovomin", dvm);
return RedirectToAction("MyProfile");
}
[Authorize]


+ 3
- 1
Sevomin.WebFrontend.Controllers/JobController.cs View File

@ -43,7 +43,9 @@ namespace Sevomin.WebFrontend.Controllers
User u = await UserManager.FindByNameAsync(User.Identity.Name);
if (u == null)
throw new InvalidOperationException("شما خیلی هنرمندی! به ما هم بگو چجوری!");
Avalin avalin = (Avalin)u;
Avalin avalin = u as Avalin;
if (avalin == null)
throw new InvalidOperationException("جای شما که اینجا نیست!");
Job job = _JobRepository.GetEmptyJobFor(avalin);
return job;
}


+ 2
- 0
Sevomin.WebFrontend/Sevomin.WebFrontend.csproj View File

@ -243,6 +243,7 @@
<Content Include="Views\Account\ProfileAvalin.cshtml" />
<Content Include="Views\Account\ProfileDovomin.cshtml" />
<Content Include="Views\Shared\Navbar.cshtml" />
<Content Include="Views\Shared\DovominParameterViewModel.cshtml" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>
@ -261,6 +262,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\resumes\" />
<Folder Include="Views\Home\" />
</ItemGroup>
<PropertyGroup>


+ 15
- 7
Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml View File

@ -1,12 +1,12 @@
@model Sevomin.Models.DovominViewModel
@{
ViewBag.Title = "ProfileDovomin";
ViewBag.Title = "ویرایش پروفایل";
}
<div class="page-header rtl">
<h1>ویرایش پروفایل <small>@Model.DisplayName</small></h1>
</div>
@using (Html.BeginForm("ProfileDovomin", "Account", FormMethod.Post, new { role = "form", @class = "assess-inputs" }))
@using (Html.BeginForm("ProfileDovomin", "Account", FormMethod.Post, new { role = "form", @class = "assess-inputs", enctype = "multipart/form-data" }))
{
<div class="row" style="margin-bottom: 20px">
<div class="col-md-12">
@ -14,16 +14,24 @@
</div>
</div>
<div class="row rtl">
<div class="panel panel-default">
<div class="panel panel-default">
<div class="panel-body">
<div class="col-md-6">
<div class="col-md-6">
<div class="form-group">
@Html.LabelFor(model => model.EnglishResume)
<input type="file" name="EnglishResume" />
@if (!string.IsNullOrWhiteSpace(Model.EnglishResume))
{
<a href="#" class="pull-left"><span class="glyphicon glyphicon-arrow-down"></span>فایل رزومه انگلیسی</a>
}
</div>
<div class="form-group">
@Html.LabelFor(model => model.PersianResume)
<input type="file" name="PersianResume" />
@if (!string.IsNullOrWhiteSpace(Model.PersianResume))
{
<a href="#" class="pull-left"><span class="glyphicon glyphicon-arrow-down"></span>فایل رزومه فارسی</a>
}
</div>
<div class="form-group">
@Html.LabelFor(model => model.Description)
@ -42,7 +50,7 @@
<div class="form-group">
@Html.LabelFor(model => model.JalaliBirthDate)
@Html.TextBoxFor(model => model.JalaliBirthDate, new { @class = "form-control datepickerify" })
</div>
</div>
<div class="checkbox">
<label>
@Html.DisplayNameFor(model => model.IsFullTime) @Html.CheckBoxFor(model => model.IsFullTime)
@ -52,13 +60,13 @@
<label>
@Html.DisplayNameFor(model => model.IsPartTime) @Html.CheckBoxFor(model => model.IsPartTime)
</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row rtl">
<div class="panel panel-default">
<div class="panel panel-default">
<div class="panel-body">
<div class="alert alert-info"><strong>سلام</strong> چطورین؟</div>
<div class="col-md-12">


+ 4
- 4
Sevomin.WebFrontend/Views/Shared/DovominParameterViewModel.cshtml View File

@ -13,17 +13,17 @@
@switch (Model.DisplayMethod)
{
case 1:
@Html.TextBox(paramId, string.Empty, new { @class = "form-control" })
@Html.TextBox(paramId, Model.StringValue, new { @class = "form-control" })
break;
case 2:
@Html.TextArea(paramId)
@Html.TextArea(paramId, Model.StringValue, new { @class = "form-control" })
break;
case 3:
/* validator bezar baraye numeric gereftan */
@Html.TextBox(paramId, string.Empty, new { @class = "form-control" })
@Html.TextBox(paramId, Model.StringValue, new { @class = "form-control" })
break;
case 4:
@Html.DropDownList(paramId, new SelectList(Model.ParameterValues, "item1", "item2"), Model.ParameterName, new { @class = "form-control" })
@Html.DropDownList(paramId, new SelectList(Model.ParameterValues, "item1", "item2", Model.StringValue), "انتخاب کنید ...", new { @class = "form-control" })
break;
default:
@MvcHtmlString.Empty


+ 1
- 1
Sevomin.WebFrontend/Views/Shared/JobParameterViewModel.cshtml View File

@ -24,7 +24,7 @@
@Html.TextBox(paramId, string.Empty, new { @class = "form-control" })
break;
case 4:
@Html.DropDownList(paramId, new SelectList(Model.ParameterValues, "item1", "item2"), Model.ParameterName, new { @class = "form-control" })
@Html.DropDownList(paramId, new SelectList(Model.ParameterValues, "item1", "item2"), "انتخاب کنید ...", new { @class = "form-control" })
break;
default:
@MvcHtmlString.Empty


Loading…
Cancel
Save