public async Task <IActionResult> PutPrescription(long id, Prescription prescription) { if (id != prescription.Id) { return(BadRequest()); } _context.Entry(prescription).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrescriptionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutDoctor(long id, Doctor doctor) { if (id != doctor.Id) { return(BadRequest()); } _context.Entry(doctor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DoctorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutBooking(long id, Booking booking) { if (id != booking.Id) { return(BadRequest()); } _context.Entry(booking).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookingExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> CollectPoints([FromForm] int memberId, [FromForm] int companyId, [FromForm] int pointsCount) { var account = _context.Accounts.SingleOrDefault(a => a.MemberId == memberId && a.CompanyId == companyId); if (account == null) { return(NotFound()); } account.Balance += pointsCount; _context.Entry(account).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(NoContent()); }