public async Task <IActionResult> PutPromoCodes([FromRoute] int id, [FromBody] PromoCodes promoCodes) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != promoCodes.Id) { return(BadRequest()); } _context.Entry(promoCodes).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PromoCodesExists(id)) { return(NotFound()); } else { throw; } } var response = new GenericResponse() { Data = promoCodes, Success = true, HttpStatusCode = HttpStatusCode.OK, Message = MessagesConstants.PromoCodeUpdate }; return(Ok(response)); }