コード例 #1
0
        public async Task <IActionResult> ScreeningEdit(int id, [Bind("ID,Username,Temperature,Status,Visit")] UserModel userModel)
        {
            if (id != userModel.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserModelExists(userModel.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(ScreeningList)));
            }
            return(View(userModel));
        }
コード例 #2
0
 public async Task <IActionResult> UserEdit(int ID, [Bind("ID,UserEmail,Type,Services,Charges,Appointment_Date,Appointment_Status,Remark,User_Booked_Date,Barber_Approved_Date,Barber_Check_In_Date")] AppointmentModel appointmentModel)
 {
     if (ID != appointmentModel.ID)
     {
         return(NotFound());
     }
     if (ModelState.IsValid)
     {
         try
         {
             if (appointmentModel.Appointment_Status == "Approved")
             {
                 appointmentModel.Appointment_Status = "Confirmed";
                 DateTime now = DateTime.Now;
                 appointmentModel.User_Confirmed_Date = now;
             }
             _context.Update(appointmentModel);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!AppointmentIDExists(appointmentModel.ID))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(UserAppointment)));
     }
     return(View(appointmentModel));
 }