Exemplo n.º 1
0
        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)));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
 public IActionResult Edit(Person person)
 {
     if (ModelState.IsValid)
     {
         _service.Edit(person);
         return(RedirectToAction("Index"));
     }
     return(View(person));
 }
Exemplo n.º 4
0
 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));
 }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
        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));
        }
Exemplo n.º 9
0
        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);

        }