Ejemplo n.º 1
0
        public void CreateOrUpdate(WorkPlaceAddModel addModel)
        {
            var resume = _managerRepository.Get(addModel.ResumeManagerId.Value).Resume;

            foreach (var work in addModel.WorkPlaces)
            {
                work.ResumeId = resume.Id;
                if (!this.UpdateWorkplace(work))
                {
                    this.CreateWorkplace(work);
                }
            }
        }
Ejemplo n.º 2
0
        public WorkPlaceAddModel Get(int managerId)
        {
            var resume = _resumeRepository.Get().FirstOrDefault(r => r.ResumeManager.Id == managerId);

            if (resume == null || resume.WorkExp.Count == 0)
            {
                return(null);
            }

            WorkPlaceAddModel addModel = new WorkPlaceAddModel();

            addModel.ResumeManagerId = managerId;
            foreach (var work in resume.WorkExp)
            {
                addModel.WorkPlaces.Add(work.ToModel());
            }

            return(addModel);
        }
Ejemplo n.º 3
0
        public ActionResult WorkExperience(int managerId, WorkPlaceAddModel addModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(addModel));
            }
            int userId = User.Identity.GetUserId <int>();

            // проверяем, владелец ли резюме шлет запрос на его изменение
            if (!_managerService.IsOwnedBy(userId, managerId))
            {
                return(new HttpUnauthorizedResult());
            }

            addModel.ResumeManagerId = managerId;
            _workPlaceService.CreateOrUpdate(addModel);

            return(RedirectToAction(string.Format("WorkExperience/{0}", managerId)));
        }