Exemplo n.º 1
0
 public void AddPersData(User_sPersonalData data)
 {
     if (data != null)
     {
         data.Id = Guid.NewGuid();
         _persDataRepository.AddData(data);
     }
 }
Exemplo n.º 2
0
        public void EditProfile(Aducation aducation, User_sContact contact, User_sPersonalData data, User user)
        {
            if (user != null)
            {
                var us       = GetUserById(user.Id);
                var persData = GetUserPersData(us.PersonalDataId);
                var cont     = GetContactById(us.ContactId);

                if (cont.Id != null)
                {
                    contact.Id = cont.Id;
                    _contactRepository.Update(contact);
                }
                else
                {
                    contact.Id = Guid.NewGuid();
                    _contactRepository.AddContact(contact);
                    us.ContactId = contact.Id;
                }



                if (persData.AducationId != null)
                {
                    aducation.Id = (Guid)persData.AducationId;
                    _aducationRepository.UpdateAducation(aducation);
                }
                else
                {
                    aducation.Id = Guid.NewGuid();
                    _aducationRepository.AddAducation(aducation);
                    persData.AducationId = aducation.Id;
                }

                data.Id          = persData.Id;
                data.ImageId     = persData.ImageId;
                data.AducationId = aducation.Id;
                _persDataRepository.Update(data);

                user.Id             = us.Id;
                user.PersonalDataId = data.Id;
                user.ContactId      = contact.Id;
                _userRepository.Update(user);
            }
        }
Exemplo n.º 3
0
        public ActionResult EditUser(UserIndexViewModel model)
        {
            if (ModelState.IsValid)
            {
                Aducation aducation = new Aducation()
                {
                    Type           = model.Type,
                    Institution    = model.Specialization,
                    StartYear      = model.StartYear,
                    GradYear       = model.GradYear,
                    Specialization = model.Specialization
                };
                User_sContact contact = new User_sContact()
                {
                    PhoneNumber = model.PhoneNumber,
                    Skype       = model.Skype
                };
                User_sPersonalData data = new User_sPersonalData()
                {
                    Name = model.Name
                };
                User user = new User()
                {
                    AspUserId = model.AspUserId,
                    Id        = model.Id
                };

                _userService.EditProfile(aducation, contact, data, user);
                return(RedirectToAction("Index", "User"));
            }
            else
            {
                // var model = GetProfileFromPage();

                return(View("EditUser", model));
            }



            //return RedirectToAction("Index", "User");
        }
Exemplo n.º 4
0
        public ActionResult AddUser(AddUserViewModel model)
        {
            if (model != null)
            {
                Image image = new Image()
                {
                    Image1 = _userService.СonvertingImg(model.Image)
                };
                _userService.AddImage(image);


                User_sPersonalData data = new User_sPersonalData()
                {
                    Name    = model.Name,
                    ImageId = image.Id
                };

                _userService.AddPersData(data);

                User_sContact contact = new User_sContact()
                {
                    PhoneNumber = model.PhoneNumber,
                    Skype       = model.Skype
                };
                _userService.AddContact(contact);

                User user = new User()
                {
                    PersonalDataId = data.Id,
                    ContactId      = contact.Id,
                    Visibility     = true,
                    AspUserId      = model.AspUserId
                };
                _userService.AddUser(user);
            }
            return(View("DisplayEmail"));
        }