public async Task <IActionResult> Create([Bind("Id,Surname,Name,Patronymic,Address,PersonalNumber,PhoneNumber,TypeClient,Unn,BothDate,Information")] Client client)
        {
            if (ModelState.IsValid)
            {
                client.Id = Guid.NewGuid();
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,IdClient,IdOrder")] ClientOrders clientOrders)
        {
            if (ModelState.IsValid)
            {
                clientOrders.Id = Guid.NewGuid();
                _context.Add(clientOrders);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdClient"] = new SelectList(_context.Clients, "Id", "Id", clientOrders.IdClient);
            ViewData["IdOrder"]  = new SelectList(_context.Orders, "Id", "Id", clientOrders.IdOrder);
            return(View(clientOrders));
        }
        public async Task <IActionResult> Create(Order order)
        {
            if (ModelState.IsValid)
            {
                order.Id          = Guid.NewGuid();
                order.DateReceipt = DateTime.Now;
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdEmployee"]     = new SelectList(_context.Employees, "Id", "Id", order.EmployeeId);
            ViewData["IdOrganization"] = new SelectList(_context.Organizations, "Id", "Id", order.OrganizationId);
            return(View(order));
        }