public ActionResult Create(Assistant assistant) { assistant.dateCreated = DateTime.Now; assistant.dateModified = DateTime.Now; assistant.CreatedByLogin = User.Identity.Name; assistant.ModifiedByLogin = User.Identity.Name; if (ModelState.IsValid) { _repo.Add(assistant); return RedirectToAction("Index"); } ViewBag.IdStatusValue = new SelectList(_repo.StatusValues, "IdStatusValue", "NameStatusValue", assistant.IdStatusValue); ViewBag.IdAssistantType = new SelectList(_repo.AssistantTypes, "IdAssistantType", "NameAssistantType", assistant.IdAssistantType); ViewBag.IdMember = new SelectList(_repo.Members, "IdMember", "MemberNumber", assistant.IdMember); return View(assistant); }
public void Update(Assistant assistant) { _db.Entry(assistant).State = EntityState.Modified; _db.SaveChanges(); }
public void Remove(Assistant assistant) { _db.Assistants.Remove(assistant); _db.SaveChanges(); }
public void Add(Assistant assistant) { _db.Assistants.Add(assistant); _db.SaveChanges(); }
public ActionResult Edit(Assistant assistant) { if (ModelState.IsValid) { _repo.Update(assistant); return RedirectToAction("Index"); } ViewBag.IdStatusValue = new SelectList(_repo.StatusValues, "IdStatusValue", "NameStatusValue", assistant.IdStatusValue); ViewBag.IdAssistantType = new SelectList(_repo.AssistantTypes, "IdAssistantType", "NameAssistantType", assistant.IdAssistantType); ViewBag.IdMember = new SelectList(_repo.Members, "IdMember", "MemberNumber", assistant.IdMember); return View(assistant); }