예제 #1
0
 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");
     }
 }
예제 #2
0
 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!";
 }