Ejemplo n.º 1
0
 public ActionResult Delete(ProductDto item)
 {
     using(_conversation.SetAsCurrent())
     {
         Product itemMapped = _mapper.Map<ProductDto, Product>(item);
         _repository.Delete(itemMapped);
         _conversation.Flush();
         return Json(new{ success = true });
     }
 }
Ejemplo n.º 2
0
 public ActionResult Create(ProductDto item)
 {
     using(_conversation.SetAsCurrent())
     {
         Product itemMapped = _mapper.Map<ProductDto, Product>(item);
         ValidationHelpers.AddErrorsToModelState(ModelState, _validator.Validate(itemMapped), "item");
         if(ModelState.IsValid)
         {
             _repository.Create(itemMapped);
             _conversation.Flush();
         }
         return Json(new{ success = true });
     }
 }