public HttpResponseMessage DecreaseUnitcostFruits(DecreaseFruitsUnitCostModel decreaseFruitsUnitCostModel) { DecreaseFruitsUnitCostDto decreaseFruitsUnitCostDto = this.mapper.Map <DecreaseFruitsUnitCostModel, DecreaseFruitsUnitCostDto>(decreaseFruitsUnitCostModel); this.productAppService.DecreaseUnitcostFruits(decreaseFruitsUnitCostDto); return(new HttpResponseMessage(HttpStatusCode.OK)); }
public void DecreaseUnitcostFruits(DecreaseFruitsUnitCostDto decreaseFruitsUnitCostDto) { using (NpgsqlConnection connection = this.databaseConnectionFactory.Instance.Create()) { connection.Open(); using (var transaction = connection.BeginTransaction()) { try { DecreaseFruitsUnitCost decreaseFruitsUnitCost = this.dtoToEntityMapper.Map <DecreaseFruitsUnitCostDto, DecreaseFruitsUnitCost>(decreaseFruitsUnitCostDto); this.productService.UpdateFruitsUnitCost(connection, decreaseFruitsUnitCost, transaction); } catch (Exception ex) { transaction.Rollback(); Console.Write(ex.Message); } } } }