Beispiel #1
0
        public void UpdateAducation(Aducation aducation)
        {
            var item = Find(aducation.Id);

            _context.Entry(item).CurrentValues.SetValues(aducation);
            base.Save();
        }
Beispiel #2
0
        public ActionResult AddUser(AddUserViewModel model)
        {
            if (model != null)
            {
                User user = new User()
                {
                    Skype      = model.Skype,
                    Name       = model.Name,
                    Surname    = model.Surname,
                    Direction  = model.Direction,
                    Visibility = true,
                    AspUserId  = model.AspUserId,
                };
                _userService.AddUser(user);

                if (model.University != null)
                {
                    Aducation adc = new Aducation()
                    {
                        University = model.University,
                        StartYear  = model.StartYear,
                        GradYear   = model.GradYear,
                        UserId     = user.Id
                    };
                    _aducationService.AddAducation(adc);
                }
            }
            return(RedirectToAction("Index", "User"));
        }
Beispiel #3
0
        public void Update(Aducation aducation)
        {
            var item = _context.Aducation.Find(aducation.Id);

            _context.Entry(item).CurrentValues.SetValues(aducation);
            Save();
        }
Beispiel #4
0
 public void AddAducation(Aducation aducation)
 {
     if (aducation != null)
     {
         aducation.Id = Guid.NewGuid();
         _aducationRepository.AddAducation(aducation);
     }
 }
Beispiel #5
0
 public void AddAducation(Aducation adc)
 {
     if (adc != null && adc.University != null)
     {
         adc.Id = Guid.NewGuid();
         _aducRepository.Add(adc);
     }
 }
Beispiel #6
0
 public ActionResult AddAducation(AducationInfo model)
 {
     if (ModelState.IsValid)
     {
         var Aducation = new Aducation
         {
             UserId     = _userService.GetIdByAspId(User.Identity.GetUserId()),
             University = model.University,
             StartYear  = model.StartYear,
             GradYear   = model.GradYear,
         };
         _aducationService.AddAducation(Aducation);
         return(Json(new { success = true }));
     }
     return(PartialView("_AddAducation", model));
 }
Beispiel #7
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);
            }
        }
Beispiel #8
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");
        }
Beispiel #9
0
 public void Add(Aducation aducation)
 {
     _context.Aducation.Add(aducation);
     Save();
 }
Beispiel #10
0
 public void AddAducation(Aducation aducation)
 {
     _context.Aducation.Add(aducation);
     base.Save();
 }
Beispiel #11
0
 public void UpdateAducation(Aducation adc)
 {
     _aducRepository.Update(adc);
 }