示例#1
0
        public async Task <IActionResult> Create([Bind("Id,Name,PassportId,Phone,DateRegister")] Client client)
        {
            if (ModelState.IsValid)
            {
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
示例#2
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,Position1")] Position position)
        {
            if (ModelState.IsValid)
            {
                _context.Add(position);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(position));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Phone,Position,Salary")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Position"] = new SelectList(_context.Positions, "Id", "Position1", employee.Position);
            return(View(employee));
        }
示例#5
0
        public async Task <IActionResult> Create([Bind("Id,Client,Text")] Suggestion suggestion)
        {
            if (ModelState.IsValid)
            {
                _context.Add(suggestion);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Client"] = new SelectList(_context.Clients, "Id", "Name", suggestion.Client);
            return(View(suggestion));
        }
        public async Task <IActionResult> Create([Bind("Id,Client,SumPrice")] TotalPrice totalPrice)
        {
            if (ModelState.IsValid)
            {
                _context.Add(totalPrice);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Client"] = new SelectList(_context.Clients, "Id", "Name", totalPrice.Client);
            return(View(totalPrice));
        }
示例#7
0
        public async Task <IActionResult> Create([Bind("Id,Name,Type,Price")] Number number)
        {
            if (ModelState.IsValid)
            {
                _context.Add(number);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Type"] = new SelectList(_context.NumberTypes, "Id", "Name", number.Type);
            return(View(number));
        }
        public async Task <IActionResult> Create([Bind("Id,IdClient,IdNumber,DateSet,DateOut,Service")] Booking booking)
        {
            if (ModelState.IsValid)
            {
                _context.Add(booking);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdClient"] = new SelectList(_context.Clients, "Id", "Name", booking.IdClient);
            ViewData["IdNumber"] = new SelectList(_context.Numbers, "Id", "Name", booking.IdNumber);
            ViewData["Service"]  = new SelectList(_context.Services, "Id", "Name", booking.Service);
            return(View(booking));
        }