コード例 #1
0
ファイル: AddJobViewModel.cs プロジェクト: dphseven/Vitae
        private void AddJob()
        {
            var ent = _kernel.Get <IExperienceEntity>();

            ent.Employer = Employer;
            ent.Titles.Add(JobTitle);
            ent.StartDate = StartDate;
            ent.EndDate   = EndDate;

            repos.Add(ent);

            JobAdded?.Invoke(this, new EventArgs());
        }
コード例 #2
0
        // Private Methods

        private void addExperience()
        {
            var job = repos.GetAll().FirstOrDefault(T => T.Employer == Employer);

            if (job != null)
            {
                job.Details.Add(Experience);
                repos.Update(job.ID, job);
            }
            else
            {
                job = _kernel.Get <IExperienceEntity>();
                job.Details.Add(Experience);
                repos.Add(job);
            }
            ExperienceAdded?.Invoke(this, new EventArgs());
        }
コード例 #3
0
        public async Task <IActionResult> PostExperience(int ownerId, [FromBody] ExperienceDto experienceDto)
        {
            if (experienceDto == null)
            {
                return(BadRequest());
            }

            Experience experience = _mapper.Map <ExperienceDto, Experience>(experienceDto);

            experience.Owner_ID = ownerId;

            bool isOk = await TryUpdateModelAsync(experience);

            if (!isOk || !ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Experience result = _experienceRepository.Add(experience);

            return(CreatedAtRoute("GetExperienceByID", new { ownerId = result.Owner_ID, id = result.ID }, _mapper.Map <Experience, ExperienceDto>(result)));
        }
コード例 #4
0
 public void CreateExperience(Experience experience)
 {
     experienceRepository.Add(experience);
 }