コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Name_of_clinic,Address,Contact")] Location location)
        {
            if (ModelState.IsValid)
            {
                _context.Add(location);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(location));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Customer_Name,Address,Customer_Age,Joining_Date")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,Staff_Name,Department,Staff_Contact")] Staff staff)
        {
            if (ModelState.IsValid)
            {
                _context.Add(staff);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(staff));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("Id,CustomerId,StaffId,LocationId")] Appointment appointment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(appointment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "Id", appointment.CustomerId);
            ViewData["LocationId"] = new SelectList(_context.Location, "Id", "Id", appointment.LocationId);
            ViewData["StaffId"]    = new SelectList(_context.Staff, "Id", "Id", appointment.StaffId);
            return(View(appointment));
        }