示例#1
0
 public IActionResult OnPostSave()
 {
     foreach (var people in PeopleList)
     {
         peopleData.AddPeople(people);
     }
     peopleData.Commit();
     return(RedirectToPage("../PeoplePage/List"));
 }
示例#2
0
        public IActionResult Create(PersonEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                string[] split = model.Name.Split(new char[0]);

                var newPerson = new Person();
                newPerson.FirstName = split[0];
                newPerson.LastName  = split[1];
                newPerson.Interests = model.Interests;
                newPerson.Birth     = model.Birth;

                newPerson = _peopleData.Add(newPerson);
                _peopleData.Commit();

                return(RedirectToAction("Search"));
            }
            return(View());
        }
示例#3
0
 public IActionResult OnPost()
 {
     Genders = htmlHelper.GetEnumSelectList <GenderType>();
     if (ModelState.IsValid)
     {
         if (PeopleEntity.Id > 0)
         {
             peopleData.UpdatePeople(PeopleEntity);
         }
         else
         {
             peopleData.AddPeople(PeopleEntity);
         }
         peopleData.Commit();
         return(RedirectToPage("./List"));
     }
     return(Page());
 }
示例#4
0
 public IActionResult OnPost(int peopleId)
 {
     peopleData.DeletePeople(peopleId);
     peopleData.Commit();
     return(RedirectToPage("./List"));
 }