Ejemplo n.º 1
0
        public IHttpActionResult AddEditExperience(ExperiencePostDto experiencePostDto)
        {
            var userId = User.Identity.GetUserId();

            if (!ModelState.IsValid)
            {
                var a  = ModelState.Values.SelectMany(msE => msE.Errors).Select(err => err.ErrorMessage);
                var c  = ModelState.Keys; //all keys or all keys that are wrong?
                var bf = "";
                foreach (var item in a)
                {
                    bf += item + ",";
                }
                return(BadRequest(bf));
            }

            var experience = Experience.Create(experiencePostDto, userId);

            _experienceRepository.AddOrEdit(experience);

            _unitOfWork.Save();

            var id = experience.ExperienceID;

            return(Ok(id));
        }
Ejemplo n.º 2
0
        public static Experience Create(ExperiencePostDto experiencePostDto, string UserID)
        {
            experiencePostDto.DeveloperID = UserID;

            return(Mapper.Map <ExperiencePostDto, Experience>(experiencePostDto));
        }