Exemplo n.º 1
0
        public JsonResult UpdateEducation(UserEducationUpdateRequest input)
        {
            _user = GetUser(HttpContext);

            var education = _educationService.Find(ue => ue.OwnerUserId == _user.Id && ue.Id == input.Id).Data;

            if (education == null)
            {
                throw new CustomException("رکوردی برای آپدیت وجود ندارد",
                                          ErrorsPreFix.CONTROLLER_ACOUNT + ERROR_UPDATE_EDUCATION + "01");
            }

            education.Grade      = input.Grade;
            education.Major      = input.Major;
            education.Place      = input.Place;
            education.InProgress = input.InProgress;

            _educationService.Update(education, _user.Id);

            return(new JsonResult(GetEducations().Value));
        }
Exemplo n.º 2
0
        public IHttpActionResult Put(UserEducationUpdateRequest model)
        {
            try
            {
                _userEduService.Update(model);
                return(Ok(new SuccessResponse()));
            }
            catch (Exception ex)
            {
                int currentUser = _currentId;
                _appLogService.Insert(new AppLogAddRequest
                {
                    AppLogTypeId = 1,
                    Message      = ex.Message,
                    StackTrace   = ex.StackTrace,
                    Title        = "Error in " + GetType().Name + " " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                    UserBaseId   = currentUser
                });

                return(BadRequest(ex.Message));
            }
        }