public static void CreateClient(ClientModel clientModel) { if (UserHelper.UserID != null) { var storageDbEntities = new StorageDBEntities(); Client newClient = new Client { Name = clientModel.Name, Address = clientModel.Address, Telephone = clientModel.Telephone, UserID = UserHelper.UserID.Value }; storageDbEntities.Clients.AddObject(newClient); storageDbEntities.SaveChanges(); } }
/// <summary> /// Create a new Client object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="telephone">Initial value of the Telephone property.</param> /// <param name="address">Initial value of the Address property.</param> /// <param name="userID">Initial value of the UserID property.</param> public static Client CreateClient(global::System.Int32 id, global::System.String name, global::System.String telephone, global::System.String address, global::System.Int32 userID) { Client client = new Client(); client.ID = id; client.Name = name; client.Telephone = telephone; client.Address = address; client.UserID = userID; return client; }
/// <summary> /// Deprecated Method for adding a new object to the Clients EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToClients(Client client) { base.AddObject("Clients", client); }