Ejemplo n.º 1
0
        public ActionResult Create_contact([DataSourceRequest] DataSourceRequest request, ContactViewModel contact)
        {
            if (contact != null && ModelState.IsValid)
            {
                try
                {
                    var c = new Contact()
                        {

                            FDPID = contact.FDPID,
                            FirstName = contact.FirstName,
                            LastName = contact.LastName,
                            PhoneNo = contact.PhoneNo,
                        };

                    _contactService.AddContact(c);
                    return RedirectToAction("Index","FDP");
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("Errors","Check");
                }
            }
            return RedirectToAction("Index","FDP");
            //return Json(new[] { contact }.ToDataSourceResult(request, ModelState));
        }
Ejemplo n.º 2
0
 public ActionResult Create_contact(int fdpId)
 {
     var fdp = _fdpService.FindById(fdpId);
     var vm = new ContactViewModel();
     vm.FDPName = fdp.Name;
     vm.FDPID = fdpId;
     return View(vm);
 }