Ejemplo n.º 1
0
        public async void SubmitPersonalInfoAsync(Person person, List <Phone> phones, List <Email> emails, List <Address> addresses)

        {
            _personInstance.FirstName      = person.FirstName;
            _personInstance.LastName       = person.LastName;
            _personInstance.BirthDate      = person.BirthDate;
            _personInstance.BirthPlaceID   = person.BirthPlaceID;
            _personInstance.ChildNumber    = person.ChildNumber;
            _personInstance.CountryID      = person.CountryID;
            _personInstance.Gender         = person.Gender;
            _personInstance.LastLoginDate  = DateTime.Today;
            _personInstance.MaritalStatus  = person.MaritalStatus;
            _personInstance.NationalCode   = person.NationalCode;
            _personInstance.Password       = person.Password;
            _personInstance.ReligionID     = person.ReligionID;
            _personInstance.ResumeContent  = person.ResumeContent;
            _personInstance.Username       = person.Username;
            _personInstance.PicFileName    = person.PicFileName;
            _personInstance.PicFileContent = person.PicFileContent;
            try
            {
                await _personController.Create(_personInstance);


                await _personController.GetList(_personInstance.ID);

                foreach (var item in phones)
                {
                    SubmitPhonesAsync(item, _personInstance.ID);
                }
                foreach (var item in addresses)
                {
                    SubmitAddressAsync(item, _personInstance.ID);
                }

                foreach (var item in emails)
                {
                    SubmitEmailAsync(item, _personInstance.ID);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public async Task <List <Common.CustomTypes.ActionResult> > SavePerson(Person person)
        {
            List <Common.CustomTypes.ActionResult> actionResults = new List <Common.CustomTypes.ActionResult>();

            try
            {
                _personInstance.FirstName      = person.FirstName;
                _personInstance.LastName       = person.LastName;
                _personInstance.BirthDate      = person.BirthDate;
                _personInstance.BirthPlaceID   = person.BirthPlaceID;
                _personInstance.ChildNumber    = person.ChildNumber;
                _personInstance.CountryID      = person.CountryID;
                _personInstance.Gender         = person.Gender;
                _personInstance.LastLoginDate  = DateTime.Today;
                _personInstance.MaritalStatus  = person.MaritalStatus;
                _personInstance.NationalCode   = person.NationalCode;
                _personInstance.Password       = person.Password;
                _personInstance.ReligionID     = person.ReligionID;
                _personInstance.ResumeContent  = Encoding.ASCII.GetBytes(person.ResumeContent ?? "");
                _personInstance.ResumeFileName = person.ResumeFileName;
                _personInstance.Username       = person.Username;
                _personInstance.PicFileName    = person.PicFileName;
                _personInstance.PicFileContent = Encoding.ASCII.GetBytes(person.PicFileContent ?? "");


                actionResults.Add(await _personController.Create(_personInstance));
                return(actionResults);
                //result.Success = true;
            }
            catch (Exception ex)
            {
                throw ex;
                //result.ErrorMessage.Add(ex.Message);
            }

            //return result;
        }