public async Task <IActionResult> Delete(int?id) { if (id != null) { TableEducational educational = await _context.TableEducational.FirstOrDefaultAsync(p => p.EducationalId == id); if (educational != null) { _context.TableEducational.Remove(educational); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } } return(NotFound()); }
public async Task <IActionResult> Create(EducationalViewModel model) { if (ModelState.IsValid) { TableEducational educational = new TableEducational { EducationType = model.EducationType.ToString(), QualificationEducation = model.QualificationEducation.ToString(), StartDate = model.StartDate, EndDate = model.EndDate, EducationalInstitutionsId = model.EducationalInstitutionsId, tableSpecialtySpecialtyId = model.tableSpecialtySpecialtyId, QualificationId = model.QualificationId, WorkerEmployeeRegistrationId = model.EmployeeRegistrationLogId }; _context.TableEducational.Add(educational); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(model)); }