예제 #1
0
        public ActionResult Edit(UserEdit usr)
        {
            usr.access_token = Request.Cookies["access_token"].Value;
            if (DataBase.Users.edit(usr))
            {
                ModelState.Add("edited", new ModelState{ Value = new ValueProviderResult("success","success",null) });
            }
            else
            {
                ModelState.Add("edited", new ModelState { Value = new ValueProviderResult("success", "failed", null) });
            }
                var at = Request.Cookies["access_token"].Value;
            UserView view = new UserView(DataBase.Users.GetByAccess(at));

            return View("Edit", view);
        }
예제 #2
0
파일: DataBase.cs 프로젝트: kioltk/mvc
 public static bool edit(UserEdit user)
 {
     try
     {
         var a_t = context.access_tokens.FirstOrDefault(at => at.token == user.access_token);
         if (a_t != null)
         {
             var u = a_t.accounts.users.FirstOrDefault();
             foreach (string field in user.fields)
             {
                 SetPropValue(u, field, GetPropValue(user, field));
             }
         }
         return false;
     }
     catch
     {
         return false;
     }
 }