public ActionResult EditEmpinPrj(EmpinPrj p_e) //изменение Projects_Employees { if (ModelState.IsValid) //validation check { using (context = new DataContext()) { var edit = context.EmpinPrjs.Where(a => a.Id == p_e.Id).FirstOrDefault(); edit.Copy(p_e);//копирование context.SaveChanges(); } return(RedirectToAction("Index")); } return(View("Error")); }
public ActionResult AddEmpinPrj(EmpinPrj p_e) //добавление сотрудников на проект { if (ModelState.IsValid) //validation check { using (context = new DataContext()) { try { context.EmpinPrjs.Add(p_e); context.SaveChanges(); } catch (Exception) { return(View("Error")); } } return(RedirectToAction("Index")); } return(View("Error")); }