Пример #1
0
 public ActionResult Add(SomeDataAddDto model)
 {
     try
     {
         _someDataService.Add(model);
         return(NoContent());
     }
     catch (Exception ex)
     {
         return(BadRequest(new { message = ex.Message }));
     }
 }
Пример #2
0
 public SomeDataAddDto Add(SomeDataAddDto model)
 {
     try
     {
         var data = _mapper.Map <SomeData>(model);
         _unitOfWork.SomeDataRepository.Add(data);
         _unitOfWork.Commit();
         return(model);
     }
     catch (DbException)
     {
         _unitOfWork.Rollback();
         throw new Exception("Add exception");
     }
 }