protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int id = -1;
                id = Util.ParseInt32(Request["id"], -1);
                if (id == -1)
                {
                    lblId.Text              = id.ToString();
                    txtEmail.Text           = string.Empty;
                    txtFirstName.Text       = string.Empty;
                    txtLastName.Text        = string.Empty;
                    txtPhone.Text           = string.Empty;
                    ddlGenero.SelectedIndex = 0;
                }
                else
                {
                    personRepository = new PersonData();

                    Person person = personRepository.GetPerson(id);

                    lblId.Text              = person.Id.ToString();
                    txtEmail.Text           = person.EmailAddress;
                    txtFirstName.Text       = person.FirstName;
                    txtLastName.Text        = person.LastName;
                    txtPhone.Text           = person.PhoneNumber;
                    ddlGenero.SelectedValue = person.Genere;
                }
            }
        }
        public IActionResult Manage(int?personId)
        {
            ViewData["Title"] = "Add Person";
            var personModel = new PersonModel();

            if (personId != null)
            {
                var personDataModel = PersonData.GetPerson(personId.Value);
                personModel       = AutoMap.Mapper.Map(personDataModel, personModel);
                ViewData["Title"] = "Edit " + personModel.FirstName + " " + personModel.LastName;
            }
            personModel.States = BuildStates();
            return(PartialView("~/Views/Person/_Manage.cshtml", personModel));
        }
Exemple #3
0
        public List <Person> GetAllPeople()
        {
            PersonData lPersonData = new PersonData();

            return(lPersonData.GetPerson());
        }