Ejemplo n.º 1
0
        public bool Remove(LocationEF entity)
        {
            if (entity is null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            return(Remove(entity.Id));
        }
Ejemplo n.º 2
0
        public LocationEF Update(LocationEF Entity)
        {
            if (Entity is null)
            {
                throw new ArgumentNullException(nameof(Entity));
            }

            return(issuesContext
                   .Locations
                   .Update(Entity)
                   .Entity);
        }
Ejemplo n.º 3
0
        public LocationEF Add(LocationEF Entity)
        {
            if (Entity is null)
            {
                throw new ArgumentNullException(nameof(Entity));
            }

            var result = issuesContext.Locations.Add(Entity);

            issuesContext.SaveChanges();
            return(result.Entity);
        }
Ejemplo n.º 4
0
        public static LocationTO ToTransfertObject(this LocationEF issue)
        {
            if (issue is null)
            {
                throw new ArgumentNullException(nameof(issue));
            }

            return(new LocationTO
            {
                LocationId = issue.LocationId,
                Name = issue.Name
            });
        }
Ejemplo n.º 5
0
 public LocationResultDto(LocationEF l)
 {
     ID          = l.ID.ToString("N");
     Type        = l.TypeID;
     Country     = l.CountryID;
     Name        = l.Name;
     NameShort   = l.NameShort;
     Avatar      = l.Avatar;
     Lat         = l.Latitude;
     Lon         = l.Longitude;
     Rating      = l.Rating;
     RatingCount = l.RatingCount;
 }
 public LocationResultDto(LocationEF l)
 {
     ID = l.ID.ToString("N");
     Type = l.TypeID;
     Country = l.CountryID;
     Name = l.Name;
     NameShort = l.NameShort;
     Avatar = l.Avatar;
     Lat = l.Latitude;
     Lon = l.Longitude;
     Rating = l.Rating;
     RatingCount = l.RatingCount;
 }
Ejemplo n.º 7
0
 public LocationDetailDto(LocationEF l)
 {
     ID          = l.ID.ToString("N");
     Name        = l.Name;
     NameShort   = l.NameShort;
     Avatar      = l.Avatar;
     Type        = l.TypeID;
     Description = l.Description;
     CountryID   = l.CountryID;
     Lat         = l.Latitude;
     Lon         = l.Longitude;
     Rating      = l.Rating;
     RatingCount = l.RatingCount;
 }
Ejemplo n.º 8
0
        public ClimbDetailDto(LocationEF loc)
        {
            LocID = loc.ID.ToString("N");

            if (!string.IsNullOrWhiteSpace(loc.NameShort))
            {
                LocName = loc.NameShort;
            }
            else
            {
                LocName = loc.Name;
            }
            //Logs = new List<ClimbDetailLoggedClimbDto>();, IEnumerable<LoggedClimb> logs
            //foreach (var l in logs.OrderByDescending(l => l.Utc)) { Logs.Add(new ClimbDetailLoggedClimbDto(l)); }
        }
Ejemplo n.º 9
0
        private void FixupLocation(LocationEF previousValue)
        {
            if (previousValue != null && previousValue.CheckIns.Contains(this))
            {
                previousValue.CheckIns.Remove(this);
            }

            if (Location != null)
            {
                if (!Location.CheckIns.Contains(this))
                {
                    Location.CheckIns.Add(this);
                }
                if (LocationID != Location.ID)
                {
                    LocationID = Location.ID;
                }
            }
        }
Ejemplo n.º 10
0
        private void FixupLocation(LocationEF previousValue)
        {
            if (previousValue != null && previousValue.LoggedClimbs.Contains(this))
            {
                previousValue.LoggedClimbs.Remove(this);
            }

            if (Location != null)
            {
                if (!Location.LoggedClimbs.Contains(this))
                {
                    Location.LoggedClimbs.Add(this);
                }
                if (Denorm_LocationID != Location.ID)
                {
                    Denorm_LocationID = Location.ID;
                }
            }
        }