public ActionResult CreateVacancy(JobOffer offer) { offer.PublishDate = DateTime.Now; offer.UserId = GetCurrentUser().UserId; if (_jobOfferRepo.Create(offer)) { _jobOfferRepo.Save(); } return(Redirect("/Vacancy/vacancy/" + offer.Id)); }
public IActionResult Edit(JobOfferEditVM model) { if (!ModelState.IsValid) { return(View(model)); } var repo = new JobOffersRepository(); var item = repo.GetById(model.ID); if (item == null) { item = new Models.JobOffer(); item.CreatorId = AuthService.LoggedUser.ID; } item.Title = model.Title; item.Description = model.Description; repo.Save(item); return(RedirectToAction("List")); }