public ActionResult AddPerson(PersonViewModel person) { if (User.Identity.IsAuthenticated) { string user_id = getUserId().ToString(); person.User_Id = Convert.ToInt16(user_id); personService.Create(Mapper.Map<PersonViewModel, PersonServiceModel>( person)); personService.Save(); IEnumerable<PersonViewModel> p = Mapper.Map<IEnumerable<PersonServiceModel>, IEnumerable<PersonViewModel>>(personService.GetAllfromUserId(user_id)); return RedirectToAction("AllPersons", p); } else { return RedirectToAction("Index", "Home"); } }
public string EditPerson(PersonViewModel person) { string user_id = getUserId().ToString(); person.User_Id = Convert.ToInt16(user_id); personService.Update(Mapper.Map<PersonViewModel, PersonServiceModel> (person)); personService.Save(); return "Saved!"; }