Exemplo n.º 1
0
        public Location SaveNewLocation(Location location)
        {
            using (var connection = new EntityConnection("name=CoreContainer"))
            {
                _core = new CoreContainer(connection);

                _core.Locations.AddObject(location);
                _core.SaveChanges();
            }

            return location;
        }
Exemplo n.º 2
0
        public LocationViewModel SaveNewLocation(LocationViewModel model)
        {
            var location = new Location
                           	{
                           		Name = model.Name,
                           		Url = model.Url,
                           		ClubId = model.Club.ClubId,
                                DateCreated = DateTime.Now
                           	};

            _locationRepository.SaveNewLocation(location);

            return model;
        }
Exemplo n.º 3
0
        public Location UpdateLocation(Location location)
        {
            using (var connection = new EntityConnection("name=CoreContainer"))
            {
                _core = new CoreContainer(connection);

                _core.Locations.Attach(_core.Locations.Single(l => l.LocationId == location.LocationId));

                _core.Locations.ApplyCurrentValues(location);

                _core.SaveChanges();
            }

            return location;
        }
Exemplo n.º 4
0
        public Location GetLocationById(int locationId)
        {
            var location = new Location();

            using (var connection = new EntityConnection("name=CoreContainer"))
            {
                _core = new CoreContainer(connection);

                location = _core.Locations
                                .Include("Club")
                                .Where(l => l.LocationId == locationId)
                                .FirstOrDefault();
            }

            return location;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Locations EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToLocations(Location location)
 {
     base.AddObject("Locations", location);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Create a new Location object.
 /// </summary>
 /// <param name="locationId">Initial value of the LocationId property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="url">Initial value of the Url property.</param>
 /// <param name="clubId">Initial value of the ClubId property.</param>
 /// <param name="dateCreated">Initial value of the DateCreated property.</param>
 public static Location CreateLocation(global::System.Int32 locationId, global::System.String name, global::System.String url, global::System.Int32 clubId, global::System.DateTime dateCreated)
 {
     Location location = new Location();
     location.LocationId = locationId;
     location.Name = name;
     location.Url = url;
     location.ClubId = clubId;
     location.DateCreated = dateCreated;
     return location;
 }