Example #1
0
        public async Task <IActionResult> Create([Bind("MaterialId,MaterialName,Description,Price")] Material material)
        {
            if (ModelState.IsValid)
            {
                _context.Add(material);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(material));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("CustomerId,Surname,Name,MiddleName,Adress,Phone,Passport")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Example #3
0
        public async Task <IActionResult> Create([Bind("TypeOfWorkId,WorkName,Description,Price")] TypeOfWork typeOfWork)
        {
            if (ModelState.IsValid)
            {
                _context.Add(typeOfWork);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(typeOfWork));
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("WorkerId,Surname,Name,MiddleName,Age,Sex,Adress,Phone,Passport,PositionId,TeamId")] Worker worker)
        {
            if (ModelState.IsValid)
            {
                _context.Add(worker);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeamId"]     = new SelectList(_context.Teams, "TeamId", "TeamName", worker.TeamId);
            ViewData["PositionId"] = new SelectList(_context.Positions, "PositionId", "PositionName", worker.PositionId);
            return(View(worker));
        }
Example #5
0
        public async Task <IActionResult> Create([Bind("OrderId,TeamId,CustomerId,TypeOfWorkId,Price,StartDate,FinishDate,ComplectionStatus,PayStatus")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"]   = new SelectList(_context.Customers, "CustomerId", "CustomerId", order.CustomerId);
            ViewData["TeamId"]       = new SelectList(_context.Teams, "TeamId", "TeamId", order.Team.TeamId);
            ViewData["TypeOfWorkId"] = new SelectList(_context.TypeOfWorks, "TypeOfWorkId", "TypeOfWorkId", order.TypeOfWorkId);
            return(View(order));
        }
Example #6
0
        public async Task <IActionResult> Create([Bind("TeamId,TeamName")] Team team)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(team);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch { }
            return(View(team));
        }