public async Task <int> Update(PriceOfferUpdateDto dto, int id, string userId) { var oldPriceOffer = await _dbContext.PriceOffers .Include(x => x.MaintenanceService) .Include(x => x.SpareParts) .SingleOrDefaultAsync(x => x.Id == id); var updatedPriceOffer = _mapper.Map(dto, oldPriceOffer); _dbContext.PriceOffers.Update(updatedPriceOffer); await _dbContext.SaveChangesAsync(); return(updatedPriceOffer.Id); }
public async Task <IActionResult> Update([FromBody] PriceOfferUpdateDto dto, int id) => await GetResponse(async (userId) => new ApiResponseViewModel(true, "PriceOffer Updated Successfully", await _service.Update(dto, id, userId)));