From 8ac18f510ef0fe967f226ecf470f38e537ce2c6f Mon Sep 17 00:00:00 2001 From: Milad Karbasizadeh Date: Mon, 31 Mar 2014 14:03:21 +0430 Subject: [PATCH] job list started --- .../HomeController.cs | 28 +++++++++++++++++-- .../JobController.cs | 11 ++++++++ .../Sevomin.WebFrontend.csproj | 4 ++- .../Views/Home/AvalinIndex.cshtml | 13 +++++++++ .../Views/Home/DovominIndex.cshtml | 8 ++++++ Sevomin.WebFrontend/Views/Job/JobList.cshtml | 17 +++++++++++ .../Views/Shared/Navbar.cshtml | 6 ++-- 7 files changed, 80 insertions(+), 7 deletions(-) create mode 100644 Sevomin.WebFrontend/Views/Home/AvalinIndex.cshtml create mode 100644 Sevomin.WebFrontend/Views/Home/DovominIndex.cshtml create mode 100644 Sevomin.WebFrontend/Views/Job/JobList.cshtml diff --git a/Sevomin.WebFrontend.Controllers/HomeController.cs b/Sevomin.WebFrontend.Controllers/HomeController.cs index 1d4120b..958e01a 100644 --- a/Sevomin.WebFrontend.Controllers/HomeController.cs +++ b/Sevomin.WebFrontend.Controllers/HomeController.cs @@ -1,15 +1,37 @@ -using System.Web.Mvc; +using Microsoft.AspNet.Identity.EntityFramework; +using Sevomin.Models; +using Sevomin.Models.Helpers; +using System.Threading.Tasks; +using System.Web.Mvc; namespace Sevomin.WebFrontend.Controllers { public class HomeController : BaseController { - public ActionResult Index() + public HomeController() + : this(new SevominUserManager(new UserStore(SevominDbContext.Current))) + { + } + + public HomeController(SevominUserManager userManager) + { + UserManager = userManager; + } + + public SevominUserManager UserManager { get; private set; } + + public async Task Index() { if (!Request.IsAuthenticated) return View("Intro"); else - return View("Intro"); + { + User user = await UserManager.FindByNameAsync(User.Identity.Name); + if(user is Avalin) + return View("AvalinIndex"); + else + return View("DovominIndex"); + } } } diff --git a/Sevomin.WebFrontend.Controllers/JobController.cs b/Sevomin.WebFrontend.Controllers/JobController.cs index c853ecb..332c19e 100644 --- a/Sevomin.WebFrontend.Controllers/JobController.cs +++ b/Sevomin.WebFrontend.Controllers/JobController.cs @@ -117,6 +117,17 @@ namespace Sevomin.WebFrontend.Controllers } return Content("boogh: " + job.Id.ToString()); } + + public PartialViewResult LatestJobList(int count) + { + return PartialView("JobList", JobRepository.Current.ListAll() + .Where(d => d.ExpireDate > DateTime.Now) + .OrderByDescending(d => d.CreateDate) + .Take(count) + .ToList() + .Select(j => new JobMiniViewModel(j)).ToList()); + } + private static void UpdateFields(string JalaliExpireDate, string ContactPersonName, string ContactPersonPhone, string ContactPersonEMail, bool IsFullTime, bool ShowCompanyName, string Description, bool ShowCompanyLogo, FormCollection form, Job job) { diff --git a/Sevomin.WebFrontend/Sevomin.WebFrontend.csproj b/Sevomin.WebFrontend/Sevomin.WebFrontend.csproj index d5b6566..56b45e9 100644 --- a/Sevomin.WebFrontend/Sevomin.WebFrontend.csproj +++ b/Sevomin.WebFrontend/Sevomin.WebFrontend.csproj @@ -256,6 +256,9 @@ + + + Web.config @@ -275,7 +278,6 @@ - 10.0 diff --git a/Sevomin.WebFrontend/Views/Home/AvalinIndex.cshtml b/Sevomin.WebFrontend/Views/Home/AvalinIndex.cshtml new file mode 100644 index 0000000..12d7c71 --- /dev/null +++ b/Sevomin.WebFrontend/Views/Home/AvalinIndex.cshtml @@ -0,0 +1,13 @@ +@{ + ViewBag.Title = "خانه"; +} + + \ No newline at end of file diff --git a/Sevomin.WebFrontend/Views/Home/DovominIndex.cshtml b/Sevomin.WebFrontend/Views/Home/DovominIndex.cshtml new file mode 100644 index 0000000..88a9f9a --- /dev/null +++ b/Sevomin.WebFrontend/Views/Home/DovominIndex.cshtml @@ -0,0 +1,8 @@ +@{ + ViewBag.Title = "خانه"; +} +
+
+ @Html.Action("LatestJobList", "Job", new { count = 15 }) +
+
\ No newline at end of file diff --git a/Sevomin.WebFrontend/Views/Job/JobList.cshtml b/Sevomin.WebFrontend/Views/Job/JobList.cshtml new file mode 100644 index 0000000..47d6095 --- /dev/null +++ b/Sevomin.WebFrontend/Views/Job/JobList.cshtml @@ -0,0 +1,17 @@ +@model IList + +
+ @foreach (var job in Model) + { +
+
+

کارشناس برنامه ریزی و کنترل پروژه + @foreach (var param in job.Parameters) + { + @MvcHtmlString.Create(string.Format(param.Item1, param.Item2) + " ") + } +

+
+
+ } +
\ No newline at end of file diff --git a/Sevomin.WebFrontend/Views/Shared/Navbar.cshtml b/Sevomin.WebFrontend/Views/Shared/Navbar.cshtml index ed92b47..2c82f69 100644 --- a/Sevomin.WebFrontend/Views/Shared/Navbar.cshtml +++ b/Sevomin.WebFrontend/Views/Shared/Navbar.cshtml @@ -19,11 +19,11 @@ else {
  • ورود به سایت
  • } -
  • تماس با ما
  • -
  • درباره ما
  • + @*
  • تماس با ما
  • +
  • درباره ما
  • *@
  • مشخصات متخصصین
  • آگهی های استخدام
  • -
  • خانه
  • +
  • خانه