public async Task <bool> UpdateSeries(Series2 s)
        {
            try
            {
                var seriesUpdate = await GetSeriesById(s.Id);

                if (seriesUpdate is null)
                {
                    return(false);
                }
                s = await SetObjects(s);

                if (s is null)
                {
                    return(false);
                }
                _db.Entry(seriesUpdate).State = EntityState.Detached;
                _db.Update(s);
                await _db.SaveChangesAsync();

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public async Task <bool> UpdateActor(Actor oldActor, Actor a)
        {
            try
            {
                var actorUpdate = await GetActorByName(oldActor.Name, oldActor.Surname);

                if (actorUpdate is null)
                {
                    return(false);
                }
                a.ActorId = actorUpdate.ActorId;
                _db.Entry(actorUpdate).State = EntityState.Detached;
                _db.Update(a);
                await _db.SaveChangesAsync();

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }