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); }
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; } }