Exemple #1
0
 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;
     }
 }
Exemple #2
0
        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;
            }
        }
Exemple #3
0
 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));
 }