public HttpResponseMessage UpdateUserInfo([FromBody] UserInfoModel userInfo) { var identity = (ClaimsIdentity)User.Identity; if (identity.Name != userInfo.UserId.ToString()) { return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, "Invalid Token")); } try { using (OnlineMusicEntities db = new OnlineMusicEntities()) { var user = (from u in db.UserInfoes where u.Id == userInfo.Id select u).FirstOrDefault(); if (user == null) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Thông tin người dùng này không tồn tại")); } userInfo.UpdateEntity(user); db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, userInfo)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }