diff --git a/Sevomin.Models/PostResultViewModel.cs b/Sevomin.Models/PostResultViewModel.cs new file mode 100644 index 0000000..60ac9c7 --- /dev/null +++ b/Sevomin.Models/PostResultViewModel.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sevomin.Models +{ + public class PostResultViewModel + { + public PostResultViewModel() + { + + } + + public PostResultViewModel(bool success, string message) + { + this.Success = success; + this.Message = message; + } + + public bool Success { get; set; } + public string Message { get; set; } + } +} diff --git a/Sevomin.Models/Sevomin.Models.csproj b/Sevomin.Models/Sevomin.Models.csproj index c769369..d5646ab 100644 --- a/Sevomin.Models/Sevomin.Models.csproj +++ b/Sevomin.Models/Sevomin.Models.csproj @@ -118,6 +118,7 @@ + diff --git a/Sevomin.WebFrontend.Controllers/AccountController.cs b/Sevomin.WebFrontend.Controllers/AccountController.cs index 160d3ab..c5776d9 100644 --- a/Sevomin.WebFrontend.Controllers/AccountController.cs +++ b/Sevomin.WebFrontend.Controllers/AccountController.cs @@ -141,8 +141,13 @@ namespace Sevomin.WebFrontend.Controllers } [Authorize] - public async Task MyProfile() + public async Task MyProfile(bool? success) { + if (success.HasValue) + { + ViewBag.Result = new PostResultViewModel(success.Value, success.Value ? "پروفایل شما با موفقیت ویرایش شد." : "در ویرایش پروفایل شما خطایی رخ داده."); + } + User u = await UserManager.FindByNameAsync(User.Identity.Name); if (u is Avalin) { @@ -195,13 +200,13 @@ namespace Sevomin.WebFrontend.Controllers } SevominDbContext.Current.SaveChanges(); + + return RedirectToAction("MyProfile", new { success = true }); } catch (Exception) { throw; - } - - return RedirectToAction("MyProfile"); + } } [Authorize] diff --git a/Sevomin.WebFrontend/Sevomin.WebFrontend.csproj b/Sevomin.WebFrontend/Sevomin.WebFrontend.csproj index d0aafd0..8585a48 100644 --- a/Sevomin.WebFrontend/Sevomin.WebFrontend.csproj +++ b/Sevomin.WebFrontend/Sevomin.WebFrontend.csproj @@ -245,6 +245,7 @@ + Web.config diff --git a/Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml b/Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml index bc84656..8d3fccd 100644 --- a/Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml +++ b/Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml @@ -3,6 +3,8 @@ ViewBag.Title = "ویرایش پروفایل"; } +@Html.Partial("PostResult", ViewBag.Result as Sevomin.Models.PostResultViewModel) + diff --git a/Sevomin.WebFrontend/Views/Job/Edit.cshtml b/Sevomin.WebFrontend/Views/Job/Edit.cshtml new file mode 100644 index 0000000..9864270 --- /dev/null +++ b/Sevomin.WebFrontend/Views/Job/Edit.cshtml @@ -0,0 +1,13 @@ + +@{ + ViewBag.Title = "ویرایش آگهی استخدام"; +} + + + +@using (Html.BeginForm("Edit", "Job", FormMethod.Post, new { role = "form", @class = "assess-inputs" })) +{ + @Html.Partial("JobEditor") +} \ No newline at end of file diff --git a/Sevomin.WebFrontend/Views/Shared/PostResult.cshtml b/Sevomin.WebFrontend/Views/Shared/PostResult.cshtml new file mode 100644 index 0000000..837ef3d --- /dev/null +++ b/Sevomin.WebFrontend/Views/Shared/PostResult.cshtml @@ -0,0 +1,5 @@ +@model Sevomin.Models.PostResultViewModel + +@if (Model != null) { +
@Model.Message
+} \ No newline at end of file