public async Task <IHttpActionResult> Update(PayUpdateDto model) { bool result = await _payService.Update(model); if (!result) { return(BadRequest()); } return(Ok()); }
public async Task <bool> Update(PayUpdateDto model) { try { var query = _context.Pay.FirstOrDefault(x => x.Id == model.Id); query.Total = model.Total; query.CourseId = model.CourseId; query.UserId = model.UserId; await _context.SaveChangesAsync(); return(true); } catch (Exception) { return(false); } }