// PUT api/TicketAreaDiscounts/5 public async Task<IHttpActionResult> PutTicketAreaDiscount(int id, int secondKey, TicketAreaDiscount ticketAreaDiscount) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != ticketAreaDiscount.TicketDiscountID && secondKey != ticketAreaDiscount.TicketAreaID) { return BadRequest(); } await repository.UpdateAsync(ticketAreaDiscount, new int[] { ticketAreaDiscount.TicketDiscountID, ticketAreaDiscount.TicketAreaID }); return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostTicketAreaDiscount(TicketAreaDiscount ticketAreaDiscount) { if (!ModelState.IsValid) { return BadRequest(ModelState); } await repository.AddAsync(ticketAreaDiscount); return CreatedAtRoute("DefaultApi", new { id = ticketAreaDiscount.TicketDiscountID, secondKey = ticketAreaDiscount.TicketAreaID }, ticketAreaDiscount); }