Example #1
0
        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);
        }
Example #2
0
 public void Update(Assistant assistant)
 {
     _db.Entry(assistant).State = EntityState.Modified;
     _db.SaveChanges();
 }
Example #3
0
 public void Remove(Assistant assistant)
 {
     _db.Assistants.Remove(assistant);
     _db.SaveChanges();
 }
Example #4
0
 public void Add(Assistant assistant)
 {
     _db.Assistants.Add(assistant);
     _db.SaveChanges();
 }
Example #5
0
 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);
 }