public async Task <IActionResult> Edit(int id, [Bind("Id,UserId,Title,Facility,AddressNation,FacilityAddressCity,FacilityAddressStreet,FacilityAddressState,Graduation,TestimonyUrl,StartDate,EndDate")] UserEducation userEducation)
        {
            if (id != userEducation.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userEducation);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserEducationExists(userEducation.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(userEducation));
        }
Пример #2
0
        public async Task <IActionResult> PutUserEducation(int id, UserEducation userEducation)
        {
            if (id != userEducation.Id)
            {
                return(BadRequest());
            }

            _context.Entry(userEducation).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserEducationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #3
0
        public void AddEducationToMember(int memberId,
                                         int?CountryId, int?RegionId, string City,
                                         int?UniversityId, string Name, string Degree, string Major, string Minor,
                                         DateTime?DateFrom, DateTime?DateTo,
                                         string Note, UserEducation Type, int?Privacy)
        {
            MemberEducation e = new MemberEducation
            {
                MemberId     = memberId,
                CountryId    = CountryId,
                RegionId     = RegionId,
                City         = City,
                UniversityId = UniversityId,
                Name         = Name,
                Degree       = Degree,
                Major        = Major,
                Minor        = Minor,
                DateFrom     = DateFrom,
                DateTo       = DateTo,
                Note         = Note,
                Type         = (int)Type,
                Privacy      = Privacy
            };

            DataContext.MemberEducations.InsertOnSubmit(e);
            Save();
        }
Пример #4
0
 public async Task<IActionResult> UpdateEducation(EducationVM vm)
 {
     var user = await _userManager.GetCurrentUser(HttpContext);
     if (vm.UserEducationID > 0)
     {
         UserEducation edu = _context.UserEducation.SingleOrDefault(x => x.UserEducationId == vm.UserEducationID);
         edu.Title = vm.Title;
         edu.SchoolName = vm.SchoolName;
         edu.CityId = vm.CityId;
         edu.CurrentStatusCheck = vm.CurrentStatusCheck;
         edu.Details = vm.Details;
         edu.StartDate = vm.StartDate;
         edu.EndDate = vm.EndDate;
     }
     else
     {
         UserEducation edu = new UserEducation();
         edu.Title = vm.Title;
         edu.SchoolName = vm.SchoolName;
         edu.CityId = vm.CityId;
         edu.CurrentStatusCheck = vm.CurrentStatusCheck;
         edu.Details = vm.Details;
         edu.StartDate = vm.StartDate;
         edu.EndDate = vm.EndDate;
         edu.UserId = user.Id;
         _context.UserEducation.Add(edu);
     }
     _context.SaveChanges();
     return RedirectToAction("Index");
     //return View("Index");
 }
Пример #5
0
        public async Task <ActionResult <UserEducation> > PostUserEducation(UserEducation userEducation)
        {
            _context.UserEducation.Add(userEducation);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetUserEducation", new { id = userEducation.Id }, userEducation));
        }
        public async Task <bool> AddNewEducation(AddEducationViewModel model)
        {
            try
            {
                var  userId      = _userAppContext.CurrentUserId;
                User userProfile = await _userRepository.GetByIdAsync(userId);

                if (userProfile == null)
                {
                    return(false);
                }

                var newEducation = new UserEducation
                {
                    Id        = ObjectId.GenerateNewId().ToString(),
                    IsDeleted = false,
                    UserId    = userId
                };
                UpdateEducationFromView(model, newEducation);
                userProfile.Education.Add(newEducation);
                await _userRepository.Update(userProfile);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #7
0
 protected void UpdateEducationFromView(AddEducationViewModel model, UserEducation original)
 {
     original.Country          = model.Country;
     original.InstituteName    = model.InstituteName;
     original.Title            = model.Title;
     original.YearOfGraduation = model.YearOfGraduation;
 }
        public ActionResult AddUserEducation(UserEducationViewModel viewmodel)
        {
            UserEducation usereducation = new UserEducation()
            {
                LinkedInUserId = User.Identity.GetUserId(),
                Degree         = viewmodel.Myeducation.Degree,
                Activities     = viewmodel.Myeducation.Activities,
                Descriptions   = viewmodel.Myeducation.Descriptions,
                EndDate        = viewmodel.Myeducation.EndDate,
                Fieldofstudy   = viewmodel.Myeducation.Fieldofstudy,
                Grade          = viewmodel.Myeducation.Grade,
                StartingDate   = viewmodel.Myeducation.StartingDate,
                University     = viewmodel.Myeducation.University
            };



            if (ModelState.IsValid)
            {
                mydatabase.UserEducationManager.Add(usereducation);
            }
            string userid = User.Identity.GetUserId();

            AppUserViewModel myviewmodel = new AppUserViewModel()
            {
                EducationList = mydatabase.UserEducationManager.GetAllBind().Where(i => i.LinkedInUserId == userid).ToList()
            };

            if (Request.IsAjaxRequest())
            {
                return(PartialView("_PartialProfileEducationwithedit", myviewmodel));
            }
            return(PartialView("_PartialProfileEducationwithedit", myviewmodel));
        }
Пример #9
0
        public ActionResult delete(int id)
        {
            UserEducation ue = new UserEducation();

            ue          = db.UserEducations.Find(id);
            ue.IsActive = false;
            return(View(ue));
        }
Пример #10
0
        public ActionResult edit(int id)
        {
            JobPortalViewModel vm = new JobPortalViewModel();
            UserEducation      ue = new UserEducation();

            ue           = db.UserEducations.Find(id);
            vm.education = ue;
            return(View(vm));
        }
Пример #11
0
        public ActionResult edit(int id, UserEducation ue)
        {
            UserEducation ues = db.UserEducations.Find(id);

            ues.ModifiedOn = System.DateTime.Now;
            db.Entry(ues).CurrentValues.SetValues(ue);
            db.SaveChanges();
            return(Json("", JsonRequestBehavior.AllowGet));
        }
Пример #12
0
        public ActionResult delete(int id, UserEducation ue)
        {
            UserEducation ues = db.UserEducations.Find(id);

            ues.IsActive = false;
            db.UserEducations.Remove(ues);
            db.SaveChanges();
            return(Json("", JsonRequestBehavior.AllowGet));
        }
Пример #13
0
        public async Task <bool> IsCanRemovable(UserEducation edu)
        {
            if (edu.IsConfirmed || edu.IsActiveEducation)
            {
                var EducationUserAnyActiveNeed = await Context.Need.AnyAsync(x => !x.IsRemoved && x.UserId == edu.UserId);

                return(!EducationUserAnyActiveNeed);
            }
            return(true);
        }
        public async Task <IActionResult> Create([Bind("Id,UserId,Title,Facility,AddressNation,FacilityAddressCity,FacilityAddressStreet,FacilityAddressState,Graduation,TestimonyUrl,StartDate,EndDate")] UserEducation userEducation)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userEducation);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(userEducation));
        }
Пример #15
0
 protected AddEducationViewModel ViewModelFromEducation(UserEducation education)
 {
     return(new AddEducationViewModel
     {
         Id = education.Id,
         Country = education.Country,
         Title = education.Title,
         Degree = education.Degree,
         YearOfGraduation = education.YearOfGraduation,
     });
 }
Пример #16
0
 protected AddEducationViewModel ViewModelFromEducation(UserEducation edu)
 {
     return(new AddEducationViewModel
     {
         Id = edu.Id,
         Country = edu.Country,
         Degree = edu.Degree,
         InstituteName = edu.InstituteName,
         Title = edu.Title,
         YearOfGraduation = edu.YearOfGraduation
     });
 }
Пример #17
0
        /// <summary>
        /// Add a education to a member
        /// </summary>
        ///
        public void AddEducationToMember(int memberId, System.Web.HttpRequest req)
        {
            UserEducation type = UserEducation.University;

            if (!StringUtils.IsNullOrWhiteSpace(req.Form["Type"]))
            {
                type = (UserEducation)Enum.Parse(typeof(UserEducation), req.Form["Type"]);
            }

            //AddEducationToMember(memberId, req.Form["Name"], req.Form["Degree"], req.Form["Major"], req.Form["City"], req.Form["Country"],
            //Parsers.Date(req.Form["DateFrom"]), Parsers.Date(req.Form["DateTo"]), req.Form["Note"], type, Parsers.Int(req.Form["Privacy"]));
        }
Пример #18
0
 protected AddEducationViewModel viewModelFromEducation(UserEducation education)
 {
     return(new AddEducationViewModel
     {
         Country = education.Country,
         InstituteName = education.InstituteName,
         Title = education.Title,
         Degree = education.Degree,
         YearOfGraduation = education.YearOfGraduation,
         Id = education.Id
     });
 }
Пример #19
0
        /// <summary>
        /// Update education of a member
        /// </summary>
        ///
        public int UpdateEducationOfMember(int locationId, int memberId, System.Web.HttpRequest req)
        {
            UserEducation type = UserEducation.University;

            if (!StringUtils.IsNullOrWhiteSpace(req.Form["Type"]))
            {
                type = (UserEducation)Enum.Parse(typeof(UserEducation), req.Form["Type"]);
            }

            return(UpdateEducationOfMember(locationId, memberId, req.Form["Degree"], req.Form["Major"], req.Form["Minor"], req.Form["City"], req.Form["Country"],
                                           Parsers.Date(req.Form["DateFrom"]), Parsers.Date(req.Form["DateTo"]), req.Form["Note"], type));
        }
Пример #20
0
        public JsonResult DeleteUserEducation(int Id)
        {
            bool result = false;
            UserEducation edu = _context.UserEducation.SingleOrDefault(x => x.UserEducationId == Id);
            if (edu != null)
            {
                _context.Remove(edu);
                _context.SaveChanges();
                result = true;
            }

            return Json(result);
        }
Пример #21
0
 public AddEducationViewModel AddNewEducation(UserEducation education)
 {
     //Your code here;
     // throw new NotImplementedException();
     return(new AddEducationViewModel
     {
         Id = education.Id,
         Country = education.Country,
         InstituteName = education.InstituteName,
         Title = education.Title,
         Degree = education.Degree,
         YearOfGraduation = education.YearOfGraduation
     });
 }
Пример #22
0
        public UserEducation ReadById(int id)
        {
            UserEducation userEdu = new UserEducation();

            DataProvider.ExecuteCmd("dbo.UserEducation_SelectById",
                                    inputParamMapper: (SqlParameterCollection inputs) =>
            {
                inputs.AddWithValue("@Id", id);
            },
                                    singleRecordMapper: (IDataReader reader, short resultSet) =>
            {
                userEdu = DataMapper <UserEducation> .Instance.MapToObject(reader);
            });
            return(userEdu);
        }
Пример #23
0
        public JsonResult AddEducation(UserEducationAddRequest input)
        {
            _user = GetUser(HttpContext);

            var education = new UserEducation()
            {
                Grade      = input.Grade,
                Major      = input.Major,
                Place      = input.Place,
                InProgress = input.InProgress,
                Status     = 0,
            };

            _educationService.Add(education, _user.Id);

            return(new JsonResult(GetEducations().Value));
        }
Пример #24
0
 //public static List<>
 public static bool SaveEducation(string username, UserEducation usereducation)
 {
     try
     {
         using (var context = new DatabaseDataContext())
         {
             if (usereducation.UserName == null)
             {
                 usereducation.UserName = username;
             }
             var user = context.Users.Single(x => x.UserName == username);
             if (usereducation.UserName != username)
             {
                 if (!UserInfo.IsAdmin(context, user))
                 {
                     return(false);
                 }
             }
             if (usereducation.ID == 0)
             {
                 context.UserEducations.InsertOnSubmit(usereducation);
             }
             else
             {
                 var temp = context.UserEducations.Single(x => x.ID == usereducation.ID);
                 if (temp.UserName != usereducation.UserName)
                 {
                     throw new Exception();
                 }
                 temp.MajorID         = usereducation.MajorID;
                 temp.OtherMajor      = usereducation.OtherMajor;
                 temp.Enteredat       = usereducation.Enteredat;
                 temp.Graduated       = usereducation.Graduated;
                 temp.OtherUniversity = usereducation.OtherUniversity;
                 temp.UniversityID    = usereducation.UniversityID;
                 temp.EducationLevel  = usereducation.EducationLevel;
             }
             context.SubmitChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #25
0
 //User Education
 public IActionResult AddEditUserEducation(int Id)
 {
     ViewBag.CountryList = new SelectList(GetCountryList(), "CountryId", "CountryName");
     EducationVM vm = new EducationVM();
     if (Id > 0)
     {
         UserEducation edu = _context.UserEducation.SingleOrDefault(x => x.UserEducationId == Id);
         vm.Title = edu.Title;
         vm.SchoolName = edu.SchoolName;
         vm.Details = edu.Details;
         vm.StartDate = edu.StartDate;
         vm.EndDate = edu.EndDate;
         vm.CurrentStatusCheck = edu.CurrentStatusCheck;
         vm.CityId = edu.CityId;
         vm.UserEducationID = edu.UserEducationId;
     }
     return PartialView(vm);
 }
Пример #26
0
        public IActionResult Education(UserEducationVM model)
        {
            var entity = new UserEducation()
            {
                University    = model.University,
                Faculty       = model.Faculty,
                Study         = model.Study,
                StudyType     = model.StudyType,
                StartDate     = model.StartDate,
                EducationType = model.EducationType,
                EndDate       = model.EndDate,
                UserId        = model.UserId
            };

            _userEducationService.Add(entity);

            return(Ok());
        }
Пример #27
0
        public int UpdateEducationOfMember(int educationId, int memberId, string Degree, string Major, string Minor, string City, string Country, DateTime?DateFrom, DateTime?DateTo,
                                           string Note, UserEducation Type)
        {
            var education = GetEducation(educationId);

            if (education.MemberId != memberId)
            {
                return(-1);
            }

            education.Degree   = Degree;
            education.Major    = Major;
            education.Minor    = Minor;
            education.City     = City;
            education.DateFrom = DateFrom;
            education.DateTo   = DateTo;
            education.Note     = Note;
            education.Type     = (int)Type;

            DataContext.SubmitChanges();

            return(educationId);
        }
Пример #28
0
        public async Task <IActionResult> PostAdd(EducationModel Model)
        {
            var AuthenticatedUserId = User.Identity.GetUserId();

            if (Model.StartYear > Model.EndYear)
            {
                return(Error("Başlangıç yılı, bitiş yılından büyük olamaz"));
            }

            if (Model.StartYear < 1980 || Model.StartYear > DateTime.Now.Year || Model.EndYear < 1980 || Model.StartYear > DateTime.Now.Year + 7)
            {
                return(Error("Başlangıç yılı, bitiş yılı ile alakalı bilgileri kontrol edip, tekrar deneyin"));
            }

            var NewEducation = new UserEducation
            {
                UserId              = Guid.Parse(AuthenticatedUserId),
                UniversityId        = Model.UniversityId,
                Department          = Model.Department.ClearExtraBlanks().CapitalizeFirstCharOfWords().RemoveLessGreaterSigns(),
                ActivitiesSocieties = Model.ActivitiesSocieties.ClearExtraBlanks().RemoveLessGreaterSigns(),
                StartYear           = Model.StartYear.ToString().RemoveLessGreaterSigns(),
                EndYear             = Model.EndYear.ToString().RemoveLessGreaterSigns(),
            };
            await Context.AddAsync(NewEducation);

            try
            {
                await Context.SaveChangesAsync();

                return(Succes("Eğitim bilgisi kaydedildi", null, 201));
            }
            catch (Exception e)
            {
                return(ReturnByInnerMessage(e));
            }
        }
Пример #29
0
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            try
            {
                if (model.Id != null)
                {
                    User existingTalent = (await _userRepository.GetByIdAsync(model.Id));



                    existingTalent.FirstName        = model.FirstName;
                    existingTalent.MiddleName       = model.MiddleName;
                    existingTalent.LastName         = model.LastName;
                    existingTalent.Gender           = model.Gender;
                    existingTalent.Email            = model.Email;
                    existingTalent.Phone            = model.Phone;
                    existingTalent.MobilePhone      = model.MobilePhone;
                    existingTalent.Address          = model.Address;
                    existingTalent.Nationality      = model.Nationality;
                    existingTalent.Description      = model.Description;
                    existingTalent.VisaStatus       = model.VisaStatus;
                    existingTalent.VisaExpiryDate   = model.VisaExpiryDate;
                    existingTalent.CvName           = model.CvName;
                    existingTalent.Summary          = model.Summary;
                    existingTalent.Description      = model.Description;
                    existingTalent.ProfilePhoto     = model.ProfilePhoto;
                    existingTalent.ProfilePhotoUrl  = model.ProfilePhotoUrl;
                    existingTalent.VideoName        = model.VideoName;
                    existingTalent.LinkedAccounts   = model.LinkedAccounts;
                    existingTalent.JobSeekingStatus = model.JobSeekingStatus;
                    existingTalent.UpdatedBy        = updaterId;
                    existingTalent.UpdatedOn        = DateTime.Now;

                    var newSkills = new List <UserSkill>();
                    foreach (var item in model.Skills)
                    {
                        var skill = existingTalent.Skills.SingleOrDefault(x => x.Id == item.Id);
                        if (skill == null)
                        {
                            skill = new UserSkill
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateSkillFromView(item, skill);
                        newSkills.Add(skill);
                    }
                    existingTalent.Skills = newSkills;


                    var newLanguage = new List <UserLanguage>();
                    foreach (var item in model.Languages)
                    {
                        var language = existingTalent.Languages.SingleOrDefault(x => x.Id == item.Id);

                        if (language == null)
                        {
                            language = new UserLanguage
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateLanguageFromView(item, language);
                        newLanguage.Add(language);
                    }
                    existingTalent.Languages = newLanguage;


                    var newEducation = new List <UserEducation>();
                    foreach (var item in model.Education)
                    {
                        var education = existingTalent.Education.SingleOrDefault(x => x.Id == item.Id);
                        if (education == null)
                        {
                            education = new UserEducation
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateEducationFromView(item, education);
                        newEducation.Add(education);
                    }
                    existingTalent.Education = newEducation;



                    var newCertifications = new List <UserCertification>();
                    foreach (var item in model.Certifications)
                    {
                        var certifications = existingTalent.Certifications.SingleOrDefault(x => x.Id == item.Id);
                        if (certifications == null)
                        {
                            certifications = new UserCertification
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateCertificationFromView(item, certifications);
                        newCertifications.Add(certifications);
                    }
                    existingTalent.Certifications = newCertifications;

                    var newExperience = new List <UserExperience>();
                    foreach (var item in model.Experience)
                    {
                        var experience = existingTalent.Experience.SingleOrDefault(x => x.Id == item.Id);
                        if (experience == null)
                        {
                            experience = new UserExperience
                            {
                                Id = ObjectId.GenerateNewId().ToString(),
                            };
                        }
                        UpdateExperienceFromView(item, experience);
                        newExperience.Add(experience);
                    }
                    existingTalent.Experience = newExperience;


                    await _userRepository.Update(existingTalent);
                }
                return(true);
            }
            catch (MongoException e)
            {
                return(false);
            }
        }
Пример #30
0
 static public void SetEducation(UserEducation education)
 {
     Put(EDUCATION, education);
 }