Exemplo n.º 1
0
 public LocationTypeViewModel(LocationType locationType)
 {
     this._mainService = new MainService();
     this.LocationTypes = this._mainService.GetLocationTypes();
     this.Icons = this._mainService.GetIcons();
     this.LocationType = locationType;
 }
Exemplo n.º 2
0
 public void Delete(LocationType locationtype)
 {
     try
     {
         this._repository.Delete(locationtype);
         this.Save();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Exemplo n.º 3
0
 public int Add(LocationType locationtype)
 {
     try
     {
         this._repository.Add<LocationType>(locationtype);
         this.Save();
         return locationtype.location_type_id;
     }
     catch (Exception)
     {
         throw new Exception("Kunde inte lägga till platstypen(säkerställ att ingen platstyp med namnet redan finns.)");
     }
 }
Exemplo n.º 4
0
        public void Update(LocationType oldLocationType, LocationType newLocationType)
        {
            try
            {
                oldLocationType.location_type_swe = newLocationType.location_type_swe;
                oldLocationType.location_type_eng = newLocationType.location_type_eng;
                oldLocationType.icon_id = newLocationType.icon_id;

                this.Save();
            }
            catch (Exception)
            {
                throw new Exception("Kunde inte spara platsTypen");
            }
        }
Exemplo n.º 5
0
 public static LocationTypeViewModel ToViewModel(LocationType locationType)
 {
     return new LocationTypeViewModel(locationType);
 }