Exemplo n.º 1
0
        public LocationModel Get(short locationId)
        {
            LocationPlaceholder placeholder = _repository.ReadLocation(locationId);

            return(new LocationModel(placeholder.LocationId, placeholder.Name, placeholder.CostRate,
                                     placeholder.Availability, placeholder.ModifiedDate));
        }
Exemplo n.º 2
0
        public void UpdateLocation(LocationPlaceholder location)
        {
            Location locationToUpdate = _context.Locations.FirstOrDefault(loc =>
                                                                          loc.LocationID == location.GetLocation().LocationID);

            if (locationToUpdate != null)
            {
                foreach (PropertyInfo info in locationToUpdate.GetType().GetProperties())
                {
                    if (info.CanWrite)
                    {
                        info.SetValue(locationToUpdate, info.GetValue(location.GetLocation()));
                    }
                }
            }
            else
            {
                throw new Exception();
            }
        }
Exemplo n.º 3
0
 public void CreateLocation(LocationPlaceholder locationPlaceholder)
 {
     _context.Locations.InsertOnSubmit(locationPlaceholder.GetLocation());
     _context.SubmitChanges();
 }
Exemplo n.º 4
0
 public void UpdateLocation(LocationPlaceholder location)
 {
     Locations[location.LocationId] = location;
 }
Exemplo n.º 5
0
 public void CreateLocation(LocationPlaceholder location)
 {
     Locations.Add(location);
 }