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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(serviceType));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Phone,Email")] 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,Title,DateCreated,DateModified,Details")] Note note)
        {
            if (ModelState.IsValid)
            {
                _context.Add(note);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(note));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("MyTaskwakeGUID,TaskwakeDetail")] MyTaskwake myTaskwake)
        {
            if (ModelState.IsValid)
            {
                myTaskwake.MyTaskwakeGUID = Guid.NewGuid();
                _context.Add(myTaskwake);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(TaskwakeDetail)));
            }
            return(View(myTaskwake));
        }
Пример #5
0
        public async Task <IActionResult> Create([Bind("Id,CustomerId,AddressFrom,AddressTo,ServiceType,TextField,Date")] Order order)
        {
            if (order.Id > 0)
            {
                order.Id = 0;
            }
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "Id", "Id", order.CustomerId);
            return(View(order));
        }