public IHttpActionResult AddEducation(EducationPostDto educationPostDto)
        {
            var userID = userId;

            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 education = Education.Create(educationPostDto, userId);

            educationRepository.AddOrEdit(education);

            _unitOfWork.Save();

            var id = education.EducationID;

            return(Ok(id));
        }
示例#2
0
        public static Education Create(EducationPostDto educationPostDto, string UserID)
        {
            educationPostDto.DeveloperID = UserID;

            return(Mapper.Map <EducationPostDto, Education>(educationPostDto));
        }