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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(subjectModel));
        }
Пример #2
0
        public async Task <IActionResult> Create(ClientModel clientModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(clientModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(clientModel));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("Id,SubjectId,Number,Price")] LaboratoryWorkModel laboratoryWorkModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(laboratoryWorkModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SubjectId"] = new SelectList(_context.Subjects, "Id", "Title", laboratoryWorkModel.SubjectId);
            return(View(laboratoryWorkModel));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("Id,ClientId,LaboratoryWorkId,RegisterDateTime,CompleteDateTime,Discount,Payed")] OrderModel orderModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orderModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"]         = new SelectList(_context.ShortClientsView, "ClientId", "ClientFullName", orderModel.ClientId);
            ViewData["LaboratoryWorkId"] = new SelectList(_context.LaboratoryWorkDetailedView, "LabWorkId", "ShortName", orderModel.LaboratoryWorkId);
            return(View(orderModel));
        }