public ProductGroupDTO Create(ProductGroupCreateDTO modelToCreate) { try { int newID = UOW.ProductGroupRepo.Create(modelToCreate); var createResult = UOW.ProductGroupRepo.GetByID(newID); UOW.SaveChanges(); return(createResult); } catch (Exception ex) { UOW.RollbackChanges(); throw ex; } }
public int Create(ProductGroupCreateDTO entityToCreate) { try { string query = @" INSERT INTO ProductGroups(ProductGroupCode, ProductGroupName, ProductGroupDescription) VALUES (@ProdGroupCode, @ProdGroupName, @ProdGroupDescription) SELECT SCOPE_IDENTITY()"; var queryParameters = new DynamicParameters(); queryParameters.Add("@ProdGroupCode", entityToCreate.ProductGroupCode); queryParameters.Add("@ProdGroupName", entityToCreate.ProductGroupName); queryParameters.Add("@ProdGroupDescription", entityToCreate.ProductGroupDescription); return(Connection.QueryFirst <int>(query, queryParameters, CurrentTrans)); } catch (Exception ex) { throw SqlExceptionHandler.HandleSqlException(ex) ?? ex; } }
public ActionResult <ProductGroupDTO> Create([FromBody] ProductGroupCreateDTO userInput) { try { return(_prodGroupManager.Create(userInput)); } catch (BaseCustomException ex) { return(BadRequest(ex.Message)); } }
public ProductGroupDTO Create(ProductGroupCreateDTO createModel) { return(_prodGroupService.Create(createModel)); }