public bool DeleteContact(Contact contact) { if (contact == null) return false; _unitOfWork.ContactRepository.Delete(contact); _unitOfWork.Save(); return true; }
// // GET: /Contact/Create public ActionResult Create(int fdpId) { ViewBag.FDPName = _contactService.FindById(fdpId).FDP.Name; ViewBag.FDPID = fdpId; var contact = new Contact { FDPID = fdpId }; return View("Create", contact); }
public void CanDoEditPostBack() { //ACT var contact = new Contact { ContactID = 1, FDPID = 1, FirstName = "Kebede", LastName = "Molla", PhoneNo = "251116123456" }; var redirectToRouteResult = _contactController.Create(contact) as RedirectToRouteResult; //Assert Assert.NotNull(redirectToRouteResult); Assert.AreEqual("Index", redirectToRouteResult.RouteValues["Action"]); Assert.AreEqual("Contact", redirectToRouteResult.RouteValues["controller"]); }
public ActionResult Create(Contact contact) { if (ModelState.IsValid) { _contactService.AddContact(contact); return RedirectToAction("Index", new { fdpId = contact.FDPID }); } ViewBag.FDPName = _contactService.FindById(contact.ContactID).FDP.Name; ViewBag.FDPID = contact.FDPID; return View("Create", contact); }
public bool EditContact(Contact contact) { _unitOfWork.ContactRepository.Edit(contact); _unitOfWork.Save(); return true; }
public bool AddContact(Contact contact) { _unitOfWork.ContactRepository.Add(contact); _unitOfWork.Save(); return true; }