Esempio n. 1
0
        public async Task <Scene> UpdateScene(Scene update)
        {
            var dest = await(from p in entities.Scene where p.SceneId == update.SceneId select p).FirstOrDefaultAsync();

            if (dest == null)
            {
                dest = new Scene()
                {
                    SceneId = Guid.NewGuid()
                };
                entities.Scene.Add(dest);
            }

            dest.Name        = update.Name;
            dest.Description = update.Description ?? string.Empty;
            dest.Duration    = update.Duration;

            await entities.SaveChangesAsync();

            return(dest);
        }
        public async Task <Setlist> UpdateSetlist(Setlist update)
        {
            var dest = await(from p in entities.Setlist where p.SetlistId == update.SetlistId select p).FirstOrDefaultAsync();

            if (dest == null)
            {
                dest = new Setlist()
                {
                    CreatedAt = DateTime.Now,
                    IsActive  = false,
                    SetlistId = Guid.NewGuid()
                };
                entities.Setlist.Add(dest);
            }

            dest.Name        = update.Name;
            dest.Description = update.Description ?? string.Empty;

            await entities.SaveChangesAsync();

            return(dest);
        }