public ActionResult Create(int id) { var user = uow.UserRepository.Get(Int32.Parse(User.Identity.GetUserId())); var model = new ResponseViewModel { AdvertisementId = id, UserId = user.Id, AdvertisementUserId = uow.AdvertisementRepository.Get(id).UserId, UserName = user.UserName, Message = "" }; return PartialView("_Create", model); }
public ActionResult Create(ResponseViewModel model) { if (ModelState.IsValid) { var response = Mapper.Map<Response>(model); uow.ResponseRepository.Insert(response); uow.Commit(); response = uow.ResponseRepository.Get(model.AdvertisementId); return Details(response.AdvertisementId); } return PartialView("_Create", model); }
public ActionResult Edit(ResponseViewModel model) { if (!ModelState.IsValid) return View(model); var response = Mapper.Map<Response>(model); uow.ResponseRepository.Update(response); uow.Commit(); return PartialView("_Details", model); }