Пример #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Price")] Service service)
        {
            if (ModelState.IsValid)
            {
                _context.Add(service);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(service));
        }
        public async Task <IActionResult> Create([Bind("Id,Fullname,Profile")] Doctor doctor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(doctor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctor));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("Id,DateTimeStart,ServiceId,DoctorId,PatientFullname,PatientPhone")] Appointment appointment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(appointment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DoctorId"]  = new SelectList(_context.Doctor, "Id", "Fullname", appointment.DoctorId);
            ViewData["ServiceId"] = new SelectList(_context.Service, "Id", "Name", appointment.ServiceId);
            return(View(appointment));
        }