public PriceCostDto UpdatePriceCost(MonthReportDto monthReport, int year, int month) { var newPriceCost = new PriceCost() { Type = monthReport.Type, Procedure = monthReport.Procedure, DateEnd = new DateTime(year, month, 1).AddMonths(1).AddDays(-1), Value = monthReport.CostPrice, }; var dbPriceCost = _priceCostDao.Get( x => x.Procedure == newPriceCost.Procedure && x.Type == newPriceCost.Type && x.DateEnd == newPriceCost.DateEnd); if (dbPriceCost.Any()) { if (dbPriceCost.Count == 1) { var dbPriceCostOld = dbPriceCost.First(); dbPriceCostOld.Value = newPriceCost.Value; _priceCostDao.Update(dbPriceCostOld); return(_map(dbPriceCostOld)); } else { throw new Exception("Найдено больше одной себестоимости!"); } } else { _priceCostDao.Create(newPriceCost); return(_map(newPriceCost)); } }
public PriceCostDto UpdatePriceCost(MonthReportDto monthReport, int year, int month) { var resp = Url.AppendPathSegment("report/UpdatePriceCost") .SetQueryParam("year", year) .SetQueryParam("month", month) .PostJsonAsync(monthReport) .ReceiveJson <PriceCostDto>(); return(resp.Result); }
public MonthReportBl(MonthReportDto dto) { if (dto != null) { Type = dto.Type; Procedure = dto.Procedure; CostPrice = dto.CostPrice; ClientCount = dto.ClientCount; PriceSumm = dto.PriceSumm; } }
public PriceCostDto UpdatePriceCost([FromBody] MonthReportDto monthReport, [FromQuery] int year, [FromQuery] int month) { return(_bl.UpdatePriceCost(monthReport, year, month)); }