public HttpResponseMessage DecreaseUnitcostVegetables(DecreaseVegetablesUnitCostModel decreaseVegetablesUnitCostModel) { DecreaseVegetablesUnitCostDto decreaseVegetablesUnitCostDto = this.mapper.Map <DecreaseVegetablesUnitCostModel, DecreaseVegetablesUnitCostDto>(decreaseVegetablesUnitCostModel); this.productAppService.DecreaseUnitcostVegetables(decreaseVegetablesUnitCostDto); return(new HttpResponseMessage(HttpStatusCode.OK)); }
public void DecreaseUnitcostVegetables(DecreaseVegetablesUnitCostDto decreaseVegetablesUnitCostDto) { using (NpgsqlConnection connection = this.databaseConnectionFactory.Instance.Create()) { connection.Open(); using (var transaction = connection.BeginTransaction()) { try { DecreaseVegetablesUnitCost decreaseVegetablesUnitCost = this.dtoToEntityMapper.Map <DecreaseVegetablesUnitCostDto, DecreaseVegetablesUnitCost>(decreaseVegetablesUnitCostDto); this.productService.UpdateVegetablesUnitCost(connection, decreaseVegetablesUnitCost, transaction); } catch (Exception ex) { transaction.Rollback(); Console.Write(ex.Message); } } } }