예제 #1
0
파일: Users.cs 프로젝트: mgoogps/carrent
 /// <summary>
 /// 修改个人信息
 /// </summary>
 /// <param name="arg"></param>
 /// <returns></returns>
 public Task <IApiResult> UpdateUsersInfo(P_Users.P_UpdateUsersInfo arg)
 {
     return(Task.Run(() =>
     {
         IApiResult hr = new IApiResult();
         try
         {
             //DAL.Users user = new DAL.Users();
             //user.UserID = userInfo.UserID;
             using (DAL.CarRentEntities db = new DAL.CarRentEntities())
             {
                 var u = db.Users.Find(arg.userid);
                 u.UserName = arg.username;
                 u.CellPhone = arg.phone;
                 u.FirstName = arg.contact;
                 u.PrimaryEmail = arg.email;
                 u.Address1 = arg.address;
                 u.UpdateTime = DateTime.Now;
                 u.ActivationCount = arg.price * 100;
                 db.SaveChanges();
             }
             hr.message = "User information is modified successfully";
             hr.result = new { url = "reload" };
         }
         catch (Exception ex)
         {
             Log.Error(this, ex);
             hr.code = StatusCode.error;
             hr.message = ex.Message;
         }
         return hr;
     }));
 }
예제 #2
0
 public async Task <IApiResult> UpdateUsersInfo([FromBody] P_Users.P_UpdateUsersInfo pars)
 {
     return(await ApiAsync(pars, new BLL.UsersManager.Users().UpdateUsersInfo));
 }