public async Task <IActionResult> Edit(int id, [Bind("DrivingCategoryId,CategoryName,Price")] DrivingCategory drivingCategory) { if (id != drivingCategory.DrivingCategoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(drivingCategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DrivingCategoryExists(drivingCategory.DrivingCategoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(drivingCategory)); }
public async Task <IActionResult> Create([Bind("DrivingCategoryId,CategoryName,Price")] DrivingCategory drivingCategory) { if (ModelState.IsValid) { _context.Add(drivingCategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(drivingCategory)); }
private void FillCtlDrivingCategories() { List <DrivingCategory> drivingCategoryes = new List <DrivingCategory>(GetDrivingCategories()); foreach (DrivingCategory drivingCategory in drivingCategoryes) { ctlDrivingCategories.Items.Add(drivingCategory); DrivingCategory clientsDrivingCategory = client.DrivingCategories.Select(c => c).Where(c => c.Id == drivingCategory.Id).SingleOrDefault(); if (clientsDrivingCategory != null) { ctlDrivingCategories.SelectedIndex = ctlDrivingCategories.Items.Count - 1; } } }
public void GetAssessmentSheetCity(AssessmentSheetViewModel data, DrivingCategory drivingCategory, ViewExamRegistration examRegistration, int id) { data.AllowedNegativePoints = drivingCategory.AllowedNegativePracticle; data.NotAppearOnTheExam = examRegistration.ExamRegistrationStatusId == 4; data.City = new List<AssessmentSheetPolygonCityViewModel>(); if (drivingCategory.Category.Trim().Equals("А") || drivingCategory.Category.Trim().Equals("A1")) { CreateQuestionListPolygonCity(id, "А кат", data.City); } else { CreateQuestionListPolygonCity(id, "бр2", data.City); } }
public void GetAssessmentSheetTheory(AssessmentSheetViewModel data, DrivingCategory drivingCategory, ViewExamRegistration examRegistration, int id) { data.AllowedNegativePoints = drivingCategory.AllowedNegativeTheory; data.NotAppearOnTheExam = examRegistration.ExamRegistrationStatusId == 4; data.Theory = new AssessmentSheetTheoryViewModel(); if (db.Report.Any(a => a.ExamRegistrationId == id)) { var existingReport = db.Report.First(f => f.ExamRegistrationId == id); data.Theory.NegativePoints = (int)existingReport.NegativePoints; } else { data.Theory.NegativePoints = 0; } }