Exemple #1
0
        public static MusealView CreateMuseal(Museal o)
        {
            var v = new MusealView();

            setCommonValues(v, o?.Data?.ID, o?.Data?.ValidFrom, o?.Data?.ValidTo);
            setMusealCommonValues(v, o?.Data?.Author, o?.Data?.Designation,
                                  o?.Data?.Info, o?.Data?.DamagesBefore, o?.Data?.DefaultLocation, o?.Data?.CurrentLocation,
                                  o?.Data?.StateBefore);
            return(v);
        }
Exemple #2
0
        public static InventoryMusealView CreateInventoryMuseal(Museal o, InventoryMuseal i)
        {
            var v = new InventoryMusealView();

            setCommonValues(v, o?.Data?.ID, o?.Data?.ValidFrom, o?.Data?.ValidTo);
            setMusealCommonValues(v, o?.Data?.Author, o?.Data?.Designation,
                                  o?.Data?.Info, o?.Data?.DamagesBefore, o?.Data?.DefaultLocation, o?.Data?.CurrentLocation,
                                  o?.Data?.StateBefore);
            v.IsChecked       = i?.Data?.IsChecked ?? false;
            v.IsFound         = i?.Data?.IsFound ?? false;
            v.HasStateChanged = i?.Data?.HasStateChanged ?? false;
            v.StateNow        = i?.Data?.State ?? MusealState.Määramata;
            v.DamagesNow      = i?.Data?.Damages;
            v.MusealID        = i?.Data?.MusealID;
            v.InventoryID     = i?.Data?.InventoryID;
            return(v);
        }
        public async Task <IActionResult> CreateMuseal([Bind(musealProperties)] MusealView c)
        {
            c.ID = c.ID ?? Guid.NewGuid().ToString();
            if (c.ID == "Unspecified")
            {
                c.ID = Guid.NewGuid().ToString();
            }
            var d = new MusealData {
                ID              = c.ID, Author = c.Author, Designation = c.Designation, Info = c.Info,
                StateBefore     = c.StateBefore, DamagesBefore = c.DamagesBefore,
                CurrentLocation = c.CurrentLocation, DefaultLocation = c.DefaultLocation,
                ValidTo         = c.ValidTo ?? DateTime.MaxValue,
                ValidFrom       = c.ValidFrom ?? DateTime.MinValue
            };
            var o = new Museal(d);
            await museals.AddObject(o);

            return(RedirectToAction("MusealsIndex"));
        }
 public async Task DeleteObject(Museal o)
 {
     dbSet.Remove(o.Data);
     await db.SaveChangesAsync();
 }
 public async Task UpdateObject(Museal o)
 {
     dbSet.Update(o.Data);
     await db.SaveChangesAsync();
 }
 public async Task AddObject(Museal o)
 {
     dbSet.Add(o.Data);
     await db.SaveChangesAsync();
 }