public ActionResult Delete(OrderDetailDto item) { using(_conversation.SetAsCurrent()) { OrderDetail itemMapped = _mapper.Map<OrderDetailDto, OrderDetail>(item); _repository.Delete(itemMapped); _conversation.Flush(); return Json(new{ success = true }); } }
public ActionResult Create(OrderDetailDto item) { using(_conversation.SetAsCurrent()) { OrderDetail itemMapped = _mapper.Map<OrderDetailDto, OrderDetail>(item); ValidationHelpers.AddErrorsToModelState(ModelState, _validator.Validate(itemMapped), "item"); if(ModelState.IsValid) { _repository.Create(itemMapped); _conversation.Flush(); } return Json(new{ success = true }); } }