public async Task <HttpResponseMessage> ChangePhoneNumber(int UserID, string PhoneNumber) { try { SettingDAL dal = new SettingDAL(); JsonResponse response = await dal.ChangePhoneNumber(UserID, PhoneNumber); if (response != null && response.Flag) { return(Request.CreateResponse <JsonResponse>(HttpStatusCode.OK, response)); } else { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, MIUWebAPI.Helper.Constants.ErrorNotFound)); } } catch (DbEntityValidationException ex) { var controllerName = ControllerContext.RouteData.Values["controller"].ToString(); var actionName = ControllerContext.RouteData.Values["action"].ToString(); Logger log = new Logger(); log.ErrorLog(ex, controllerName, actionName); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, MIUWebAPI.Helper.Constants.ErrorSysError)); } }