public void RegisterCompany(string name, string city, string address, string phone, string email) { using (var db = new TransportSystemDB()) { Company company = new Company() { Name = name, City = city, Address = address, PhoneNumber = phone, Email = email }; db.Companies.AddObject(company); db.SaveChanges(); } }
private void EditCompanyAttribute(string attribute, Company editedCompany, string value) { switch (attribute) { case "Name": editedCompany.Name = value; break; case "City": editedCompany.City = value; break; case "Address": editedCompany.Address = value; break; case "Phone": editedCompany.PhoneNumber = value; break; case "Email": editedCompany.Email = value; break; } }
/// <summary> /// Create a new Company object. /// </summary> /// <param name="name">Initial value of the Name property.</param> /// <param name="city">Initial value of the City property.</param> /// <param name="address">Initial value of the Address property.</param> /// <param name="phoneNumber">Initial value of the PhoneNumber property.</param> /// <param name="email">Initial value of the Email property.</param> public static Company CreateCompany(global::System.String name, global::System.String city, global::System.String address, global::System.String phoneNumber, global::System.String email) { Company company = new Company(); company.Name = name; company.City = city; company.Address = address; company.PhoneNumber = phoneNumber; company.Email = email; return company; }
/// <summary> /// Deprecated Method for adding a new object to the Companies EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCompanies(Company company) { base.AddObject("Companies", company); }