public ActionResult Add(SomeDataAddDto model) { try { _someDataService.Add(model); return(NoContent()); } catch (Exception ex) { return(BadRequest(new { message = ex.Message })); } }
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"); } }