public ActionResult EditRequest(SaleEditRequestInputModel model, int id) { if (ModelState.IsValid) { var sale = _repository.First<Sale>(x => x.Id == model.SaleId); var category = _repository.First<Category>(x => x.Id == model.CategoryId); var editRequest = Mapper.Map<SaleEditRequestInputModel, SaleEditRequest>(model); editRequest.CreateDateTime = sale.CreateDateTime; editRequest.EditRequestTime = DateTime.Now; editRequest.Reviewed = false; editRequest.OriginalSale = sale; editRequest.Category = category; _repository.Create(editRequest); //category.AddSaleEdit(editRequest); //account.AddSaleEdit(editRequest); //sale.AddSaleEdit(editRequest); //_repository.Update(sale); Success("The edit request was send!"); return RedirectToAction("index"); } return View("EditRequest", model); }
public ActionResult EditAprove(SaleEditRequestInputModel model, int id) { if (ModelState.IsValid) { var sale = _repository.GetById<SaleEditRequest>(model.Id); var sale2 = _repository.GetById<Sale>(model.SaleId); sale.OriginalSale = sale2; _repository.Update(sale); Success("The model was updated!"); return RedirectToAction("index"); } return View("Create", model); }