示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title")] SubjectModel subjectModel)
        {
            if (id != subjectModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(subjectModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubjectModelExists(subjectModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(subjectModel));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Email,SequentialNumber")] ClientModel clientModel)
        {
            if (id != clientModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clientModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientExists(clientModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(clientModel));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,SubjectId,Number,Price")] LaboratoryWorkModel laboratoryWorkModel)
        {
            if (id != laboratoryWorkModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(laboratoryWorkModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LaboratoryWorkModelExists(laboratoryWorkModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SubjectId"] = new SelectList(_context.Subjects, "Id", "Title", laboratoryWorkModel.SubjectId);
            return(View(laboratoryWorkModel));
        }
示例#4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ClientId,LaboratoryWorkId,RegisterDateTime,CompleteDateTime,Discount,Payed")] OrderModel orderModel)
        {
            if (id != orderModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orderModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderModelExists(orderModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }