You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

42 lines
1.3 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Sevomin.Models;
using Sevomin.Models.Repositories;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Sevomin.Models.Helpers;
namespace Sevomin.WebFrontend.Controllers
{
public class JobController : AuthorizedController
{
IJobRepository _JobRepository;
public SevominUserManager UserManager { get; private set; }
public JobController()
: this(JobRepository.Current, new SevominUserManager(new UserStore<User>(SevominDbContext.Current)))
{
}
public JobController(IJobRepository jobRepository, SevominUserManager userManager)
{
_JobRepository = jobRepository;
UserManager = userManager;
}
public async Task<ActionResult> NewJob()
{
User u = await UserManager.FindByNameAsync(User.Identity.Name);
if (u == null)
throw new InvalidOperationException("شما خیلی هنرمندی! به ما هم بگو چجوری!");
Avalin avalin = (Avalin)u;
Job job = _JobRepository.GetEmptyJobFor(avalin);
JobViewModel jvm = new JobViewModel(job);
return View(jvm);
}
}
}