예제 #1
0
 public ActionResult ManageUniversities(FormCollection values)
 {
     var location = new Location()
     {
         LocationName = values["LocationName"],
         BusinessName = values["LocationName"],
         FirstName = values["LocationName"],
         LastName = values["LocationName"],
         Address1 = values["Address1"],
         Address2 = values["Address2"],
         City = values["City"],
         StateOrProvince = values["State"],
         ZipCode = values["ZipCode"],
         PhoneNumber = values["PhoneNumber"],
         Country = "United States",
         CountryCode = "US"
     };
     db.Locations.AddObject(location);
     var universityName = values["UniversityName"];
     var university = new University()
     {
         Location = location,
         UniversityName = universityName
     };
     db.Universities.AddObject(university);
     db.SaveChanges();
     return View(new UniversitiesViewModel() { Universities = db.Universities });
 }
예제 #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Universities EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUniversities(University university)
 {
     base.AddObject("Universities", university);
 }
예제 #3
0
 public static void SetSelectedUniversity(HttpContextBase context, University university)
 {
     HttpCookie selectedUniversity = new HttpCookie(SelectedUniversitySessionKey);
     selectedUniversity.Value = university.UniversityId.ToString();
     selectedUniversity.Expires = DateTime.Now.AddYears(2);
     context.Response.Cookies.Add(selectedUniversity);
 }
예제 #4
0
 /// <summary>
 /// Create a new University object.
 /// </summary>
 /// <param name="universityId">Initial value of the UniversityId property.</param>
 /// <param name="universityName">Initial value of the UniversityName property.</param>
 /// <param name="universityLocationId">Initial value of the UniversityLocationId property.</param>
 public static University CreateUniversity(global::System.Int32 universityId, global::System.String universityName, global::System.Int32 universityLocationId)
 {
     University university = new University();
     university.UniversityId = universityId;
     university.UniversityName = universityName;
     university.UniversityLocationId = universityLocationId;
     return university;
 }