public static void AddUser(User user) { List<User> users = _Users; user.Id = users.Count + 1; users.Add(user); _Users = users; }
public void Save(User user) { var serializer = new XmlSerializer(typeof(User)); using (FileStream fileStream = File.Open(GetFilePath(GetFileNameForUserId(user.Id)), FileMode.OpenOrCreate, FileAccess.Write)) { serializer.Serialize(fileStream, user); } }
public ActionResult User(Models.User data) { try { Repository.User userData = new Repository.User(); userData.FirstName = data.FirstName; userData.LastName = data.LastName; UserService.Create(userData); } catch (Exception ex) { Response.StatusCode = 500; return(Json(new { error = ex.Message })); } return(View()); }
public static void UpdateUser(User user) { List<User> users = _Users; if(users.Any(u => u.Id == user.Id)) { foreach (User usr in users) { if(usr.Id == user.Id) { usr.Name = user.Name; } } } _Users = users; }
/// <summary> /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUsers(User user) { base.AddObject("Users", user); }
/// <summary> /// Create a new User object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="email">Initial value of the Email property.</param> /// <param name="password">Initial value of the Password property.</param> /// <param name="salt">Initial value of the Salt property.</param> public static User CreateUser(global::System.Int32 id, global::System.String email, global::System.String password, global::System.String salt) { User user = new User(); user.Id = id; user.Email = email; user.Password = password; user.Salt = salt; return user; }
public void Update(User entity) { throw new NotImplementedException(); }