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

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            return(View(roomRate));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Specificaion")] ServiceType servicetype)
        {
            if (ModelState.IsValid)
            {
                _context.Add(servicetype);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            return(View(servicetype));
        }
        public async Task <IActionResult> Create([Bind("TeacherId,Name,SurName,MiddleName,Position,Education")] Teacher teacher)
        {
            if (ModelState.IsValid)
            {
                _context.Add(teacher);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            return(View(teacher));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("Id,FullName,Position")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Пример #5
0
        public async Task <IActionResult> Create([Bind("Id,FullName,PassportData,NameOfRoom,List,TotalCost")] Client client)
        {
            if (ModelState.IsValid)
            {
                _context.Add(client);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
        public async Task <IActionResult> Create([Bind("ListenerId,Name,Surname,MiddleName,DateOfBirth,Address,Phone,PassportData")] Listener listener)
        {
            if (ModelState.IsValid)
            {
                _context.Add(listener);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            return(View(listener));
        }
Пример #7
0
        public async Task <IActionResult> Create([Bind("Id,Type,Capacity,Specification,RoomRateId")] Room room)
        {
            if (ModelState.IsValid)
            {
                _context.Add(room);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            return(View(room));
        }
        public async Task <IActionResult> Create([Bind("CourseId,Name,TrainingProgram,Description,IntensityOfClasses,GroupSize,FreePlaces,NumberOfHours,Cost,TeacherId")] Course course)
        {
            if (ModelState.IsValid)
            {
                _context.Add(course);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeacherId"] = new SelectList(_context.Teachers, "TeacherId", "TeacherId", course.TeacherId);
            return(View(course));
        }
Пример #9
0
        public async Task <IActionResult> Create([Bind("Id,Cost,ServiceTypeId,EmployeeId")] Service service)
        {
            if (ModelState.IsValid)
            {
                _context.Add(service);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"]    = new SelectList(_context.Employees, "Id", "Id", service.EmployeeId);
            ViewData["ServiceTypeId"] = new SelectList(_context.ServiceTypes, "Id", "Id", service.ServiceTypeId);
            return(View(service));
        }
        public async Task <IActionResult> Create([Bind("PaymentId,NameOfCourses,Date,Sum,ListenerId,CourseId")] Payment payment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(payment);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"]   = new SelectList(_context.Courses, "CourseId", "CourseId", payment.CourseId);
            ViewData["ListenerId"] = new SelectList(_context.Listeners, "ListenerId", "ListenerId", payment.ListenerId);
            return(View(payment));
        }
Пример #11
0
        public async Task <IActionResult> Create([Bind("Id,CheckInDate,CheckOut,EmployeeId,ClientId,RoomId")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"]   = new SelectList(_context.Clients, "Id", "Id", order.ClientId);
            ViewData["EmployeeId"] = new SelectList(_context.Set <Employee>(), "Id", "Id", order.EmployeeId);
            ViewData["RoomId"]     = new SelectList(_context.Rooms, "Id", "Id", order.RoomId);
            return(View(order));
        }