public async Task <ActionResult <CommercialDeal> > PostCommercialDeal(CommercialDeal commercialDeal) { _context.CommercialDeal.Add(commercialDeal); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCommercialDeal", new { id = commercialDeal.Id }, commercialDeal)); }
public async Task <IActionResult> PutCommercialDeal(int id, CommercialDeal commercialDeal) { if (id != commercialDeal.Id) { return(BadRequest()); } _context.Entry(commercialDeal).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommercialDealExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }