diff --git a/Sevomin.Models/Repositories/JobRepository.cs b/Sevomin.Models/Repositories/JobRepository.cs index c300101..d3fd0f6 100644 --- a/Sevomin.Models/Repositories/JobRepository.cs +++ b/Sevomin.Models/Repositories/JobRepository.cs @@ -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; } diff --git a/Sevomin.WebFrontend.Controllers/AccountController.cs b/Sevomin.WebFrontend.Controllers/AccountController.cs index b11329b..160d3ab 100644 --- a/Sevomin.WebFrontend.Controllers/AccountController.cs +++ b/Sevomin.WebFrontend.Controllers/AccountController.cs @@ -160,7 +160,7 @@ namespace Sevomin.WebFrontend.Controllers [HttpPost] public async Task 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] diff --git a/Sevomin.WebFrontend.Controllers/JobController.cs b/Sevomin.WebFrontend.Controllers/JobController.cs index 929d64e..c853ecb 100644 --- a/Sevomin.WebFrontend.Controllers/JobController.cs +++ b/Sevomin.WebFrontend.Controllers/JobController.cs @@ -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; } diff --git a/Sevomin.WebFrontend/Sevomin.WebFrontend.csproj b/Sevomin.WebFrontend/Sevomin.WebFrontend.csproj index ddf8ba7..c04667e 100644 --- a/Sevomin.WebFrontend/Sevomin.WebFrontend.csproj +++ b/Sevomin.WebFrontend/Sevomin.WebFrontend.csproj @@ -243,6 +243,7 @@ + Web.config @@ -261,6 +262,7 @@ + diff --git a/Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml b/Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml index 2e82bcf..bc84656 100644 --- a/Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml +++ b/Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml @@ -1,12 +1,12 @@ @model Sevomin.Models.DovominViewModel @{ - ViewBag.Title = "ProfileDovomin"; + ViewBag.Title = "ویرایش پروفایل"; } -@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" })) {
@@ -14,16 +14,24 @@
-
+
-
+
@Html.LabelFor(model => model.EnglishResume) + @if (!string.IsNullOrWhiteSpace(Model.EnglishResume)) + { + فایل رزومه انگلیسی + }
@Html.LabelFor(model => model.PersianResume) + @if (!string.IsNullOrWhiteSpace(Model.PersianResume)) + { + فایل رزومه فارسی + }
@Html.LabelFor(model => model.Description) @@ -42,7 +50,7 @@
@Html.LabelFor(model => model.JalaliBirthDate) @Html.TextBoxFor(model => model.JalaliBirthDate, new { @class = "form-control datepickerify" }) -
+
+
-
+
سلام چطورین؟
diff --git a/Sevomin.WebFrontend/Views/Shared/DovominParameterViewModel.cshtml b/Sevomin.WebFrontend/Views/Shared/DovominParameterViewModel.cshtml index 014f942..c9a505d 100644 --- a/Sevomin.WebFrontend/Views/Shared/DovominParameterViewModel.cshtml +++ b/Sevomin.WebFrontend/Views/Shared/DovominParameterViewModel.cshtml @@ -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 diff --git a/Sevomin.WebFrontend/Views/Shared/JobParameterViewModel.cshtml b/Sevomin.WebFrontend/Views/Shared/JobParameterViewModel.cshtml index fff5617..b2d1a91 100644 --- a/Sevomin.WebFrontend/Views/Shared/JobParameterViewModel.cshtml +++ b/Sevomin.WebFrontend/Views/Shared/JobParameterViewModel.cshtml @@ -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