예제 #1
0
        public IHttpActionResult PutPersonalInformations(int id, PersonalInformationModel model)
        {
            try
            {
                _logger.Debug(string.Format("ini process - Put,idUser:{0}", CurrentIdUser));

                if (id != model.Id)
                {
                    _logger.Debug(string.Format("ini Put - inValid,idUser:{0}", CurrentIdUser));
                    return(BadRequest("Invalid ID"));
                }

                if (!ModelState.IsValid)
                {
                    _logger.Debug(string.Format("ini Put - inValid,idUser:{0}", CurrentIdUser));
                    return(BadRequest(ModelState));
                }

                _logger.Debug(string.Format("ini update ,idUser: {0}, modelId update: {1}", CurrentIdUser, id));

                PersonalInformation personalinformation = AutoMapper.Mapper.Map <PersonalInformation>(model);

                personalinformation.LastActivityIdUser = CurrentIdUser;

                _personalinformationBL.Update(personalinformation);

                _logger.Debug(string.Format("finish Put - success,idUser:{0}", CurrentIdUser));

                return(Ok(new JsonResponse {
                    Success = true, Message = "PersonalInformation was Saved successfully", Data = personalinformation
                }));
            }
            catch (Exception ex)
            {
                LogError(ex);
                return(InternalServerError(ex));
            }
        }