public ActionResult Create(Company company) { if (ModelState.IsValid) { db.Companies.AddObject(company); db.SaveChanges(); return RedirectToAction("Index"); } return View(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); }
/// <summary> /// Create a new Company object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="creationDate">Initial value of the CreationDate property.</param> /// <param name="usersLimit">Initial value of the UsersLimit property.</param> /// <param name="domain">Initial value of the Domain property.</param> /// <param name="city">Initial value of the City property.</param> /// <param name="street">Initial value of the Street property.</param> /// <param name="houseNumber">Initial value of the HouseNumber property.</param> /// <param name="bankAccount">Initial value of the BankAccount property.</param> /// <param name="bankBranch">Initial value of the BankBranch property.</param> /// <param name="bankNumber">Initial value of the BankNumber property.</param> /// <param name="telephoneNumber">Initial value of the TelephoneNumber property.</param> /// <param name="companyNumber">Initial value of the CompanyNumber property.</param> /// <param name="isUsingExternalAccountManagment">Initial value of the IsUsingExternalAccountManagment property.</param> /// <param name="isCanceled">Initial value of the IsCanceled property.</param> /// <param name="coinSign">Initial value of the CoinSign property.</param> public static Company CreateCompany(global::System.Int32 id, global::System.String name, global::System.DateTime creationDate, global::System.Int32 usersLimit, global::System.String domain, global::System.String city, global::System.String street, global::System.Int32 houseNumber, global::System.String bankAccount, global::System.String bankBranch, global::System.String bankNumber, global::System.String telephoneNumber, global::System.String companyNumber, global::System.Boolean isUsingExternalAccountManagment, global::System.Boolean isCanceled, global::System.String coinSign) { Company company = new Company(); company.Id = id; company.Name = name; company.CreationDate = creationDate; company.UsersLimit = usersLimit; company.Domain = domain; company.City = city; company.Street = street; company.HouseNumber = houseNumber; company.BankAccount = bankAccount; company.BankBranch = bankBranch; company.BankNumber = bankNumber; company.TelephoneNumber = telephoneNumber; company.CompanyNumber = companyNumber; company.IsUsingExternalAccountManagment = isUsingExternalAccountManagment; company.IsCanceled = isCanceled; company.CoinSign = coinSign; return company; }
public ActionResult Edit(Company company) { if (ModelState.IsValid) { db.Companies.Attach(company); db.ObjectStateManager.ChangeObjectState(company, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(company); }