Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,FullName,PassportSeries,PassportNumber,BirthdayDate,Address,PhoneNumber")] Client client)
        {
            if (ModelState.IsValid)
            {
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Salary,Duties,Requirement")] Position position)
        {
            if (ModelState.IsValid)
            {
                _context.Add(position);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(position));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Id,FullName,BirthdayDate,Address,PhoneNumber,PositionId")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PositionId"] = new SelectList(_context.Positions, "Id", "Name", employee.PositionId);
            return(View(employee));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("Id,SubscriptDate,EndDate,ServiceId,EmployeeId,ClientId")] Contract contract)
        {
            if (ModelState.IsValid)
            {
                _context.Add(contract);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"]   = new SelectList(_context.Clients, "Id", "FullName", contract.ClientId);
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "Id", "FullName", contract.EmployeeId);
            ViewData["ServiceId"]  = new SelectList(_context.Services, "Id", "Name", contract.ServiceId);
            return(View(contract));
        }