Browse Source

Form Results begin

confirmation-email
Milad Karbasizadeh 11 years ago
parent
commit
10646245ed
7 changed files with 56 additions and 4 deletions
  1. +25
    -0
      Sevomin.Models/PostResultViewModel.cs
  2. +1
    -0
      Sevomin.Models/Sevomin.Models.csproj
  3. +9
    -4
      Sevomin.WebFrontend.Controllers/AccountController.cs
  4. +1
    -0
      Sevomin.WebFrontend/Sevomin.WebFrontend.csproj
  5. +2
    -0
      Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml
  6. +13
    -0
      Sevomin.WebFrontend/Views/Job/Edit.cshtml
  7. +5
    -0
      Sevomin.WebFrontend/Views/Shared/PostResult.cshtml

+ 25
- 0
Sevomin.Models/PostResultViewModel.cs View File

@ -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; }
}
}

+ 1
- 0
Sevomin.Models/Sevomin.Models.csproj View File

@ -118,6 +118,7 @@
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Parameter.cs" />
<Compile Include="ParameterValue.cs" />
<Compile Include="PostResultViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Repositories\IRepository.cs" />
<Compile Include="Repositories\JobRepository.cs" />


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

@ -141,8 +141,13 @@ namespace Sevomin.WebFrontend.Controllers
}
[Authorize]
public async Task<ActionResult> MyProfile()
public async Task<ActionResult> 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]


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

@ -245,6 +245,7 @@
<Content Include="Views\Shared\Navbar.cshtml" />
<Content Include="Views\Shared\DovominParameterViewModel.cshtml" />
<Content Include="Views\Job\Edit.cshtml" />
<Content Include="Views\Shared\PostResult.cshtml" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>


+ 2
- 0
Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml View File

@ -3,6 +3,8 @@
ViewBag.Title = "ویرایش پروفایل";
}
@Html.Partial("PostResult", ViewBag.Result as Sevomin.Models.PostResultViewModel)
<div class="page-header rtl">
<h1>ویرایش پروفایل <small>@Model.DisplayName</small></h1>
</div>


+ 13
- 0
Sevomin.WebFrontend/Views/Job/Edit.cshtml View File

@ -0,0 +1,13 @@

@{
ViewBag.Title = "ویرایش آگهی استخدام";
}
<div class="page-header rtl">
<h1>ویرایش آگهی استخدام <small>لورم ایپسوم</small></h1>
</div>
@using (Html.BeginForm("Edit", "Job", FormMethod.Post, new { role = "form", @class = "assess-inputs" }))
{
@Html.Partial("JobEditor")
}

+ 5
- 0
Sevomin.WebFrontend/Views/Shared/PostResult.cshtml View File

@ -0,0 +1,5 @@
@model Sevomin.Models.PostResultViewModel
@if (Model != null) {
<div class="alert @(Model.Success ? "alert-success" : "alert-danger")">@Model.Message</div>
}

Loading…
Cancel
Save