public async Task <IActionResult> PutCustomer(int id, Customer customer)
        {
            if (id != customer.CustomerID)
            {
                return(BadRequest());
            }

            _context.Entry(customer).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#2
0
 public ActionResult Edit(Patient patient, int DoctorId)
 {
     if (DoctorId != 0)
     {
         _db.DoctorPatientSpecialties.Add(new DoctorPatientSpecialty()
         {
             DoctorId = DoctorId, PatientId = patient.PatientId
         });
     }
     _db.Entry(patient).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
示例#3
0
 public async Task PutEmployeeAsync(Guid id, IEmployee employee)
 {
     _context.Entry(employee).State = EntityState.Modified;
     try
     {
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         if (!EmployeeExists(id))
         {
             throw new KeyNotFoundException();
         }
         else
         {
             throw new Exception();
         }
     }
 }
 public ActionResult Edit(Doctor doctor)
 {
     _db.Entry(doctor).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }