public IActionResult EditPeople(int id) { Person person = new Person(); person.FirstName = "EditFName"; person.LastName = "EditLName"; person.PhoneNumber = "123456789"; person.Address = "EditAddress"; ps.Edit(id, person); peopleViewModel = ps.All(); return(RedirectToAction(nameof(Add_View_People))); }
public async Task <IActionResult> Edit(int id, [Bind("ID,PrivateNo,FirstName,LastName,BirthDate,Phone,Profession")] PersonModel person) { if (id != person.ID) { return(View("GeneralError", new GeneralErrorViewModel("არასწორი იდენტიფიკატორი"))); } if (ModelState.IsValid) { try { _ps.Edit(person); } catch (DbUpdateConcurrencyException) { if (!_ps.PersonExists(person.ID)) { return(View("GeneralError", new GeneralErrorViewModel("პიროვნება ვერ მოიძებნა"))); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(person)); }
public IActionResult Edit(Person person) { if (ModelState.IsValid) { _service.Edit(person); return(RedirectToAction("Index")); } return(View(person)); }
public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,BirthDay,BirthPlace")] PeopleViewModel peopleViewModel) { if (ModelState.IsValid) { People people = Mapper.Map <PeopleViewModel, People>(peopleViewModel); _service.Edit(people); return(RedirectToAction("Index")); } return(View(peopleViewModel)); }
public ActionResult Edit([Bind("ixPerson,sPerson,sFirstName,sLastName,ixLanguage")] PeoplePost people) { if (ModelState.IsValid) { people.UserName = User.Identity.Name; _peopleService.Edit(people); return(RedirectToAction("Index")); } ViewBag.ixLanguage = new SelectList(_peopleService.selectLanguages().Select(x => new { x.ixLanguage, x.sLanguage }), "ixLanguage", "sLanguage", people.ixLanguage); return(View(people)); }
public IActionResult Edit(Person person) { CreatePersonViewModel createPerson = new CreatePersonViewModel(); createPerson.Name = person.Name; createPerson.PhoneNumber = person.PhoneNumber; createPerson.City = person.City; //Model.IPeopleRepo irepo = new IPeopleRepo(); Person editPerson = _peopleService.Edit(person.Id, createPerson); return(PartialView("_PersonPartialView", editPerson)); }
public IActionResult Edit(int id, CreatePerson createPerson) { if (ModelState.IsValid) { Person person = _peopleService.Edit(id, createPerson); return(RedirectToAction(nameof(Index))); } EditPerson editPerson = new EditPerson(); editPerson.Id = id; editPerson.CreatePerson = createPerson; return(View(editPerson)); }
public IActionResult Update(EditPersonViewModel personVM) { Person updPerson = _service.FindBy(personVM.Id); if (updPerson == null) { return(RedirectToAction(nameof(Index))); } if (ModelState.IsValid) { _service.Edit(personVM.Id, personVM); return(RedirectToAction(nameof(Index))); } return(View(personVM)); }
public ActionResult Edit(CreatePersonViewModel person, int id) { if (person.ShouseLanguage != null) { foreach (var language in person.ShouseLanguage) { Language personLanguage = _languageService.FindBy(language); } } // Make it work Save to database Language City city = _citysService.FindBy(person.City.Id); person.City = city; Person editPerson = _peopleService.Edit(id, person); return(RedirectToAction(nameof(Index))); }
public IActionResult Edit(int id, CreatePersonViewModel createPerson) { Person person = _peopleService.FindbyId(id); if (person == null) { return RedirectToAction(nameof(Index)); } if (ModelState.IsValid) { _peopleService.Edit(id, createPerson); return RedirectToAction(nameof(Index)); } EditPerson editPerson = new EditPerson(id, createPerson); editPerson.Citylist = _cityService.All();// return View(editPerson); }