コード例 #1
0
      public ActionResult Edit(Hall data)
      {
          var entity = context.Entry(data);

          entity.State = System.Data.Entity.EntityState.Modified;
          context.SaveChanges();
          return(RedirectToAction("Index"));
      }
コード例 #2
0
        public User Update(User obj)
        {
            var updatedEntry = _cinemaContext.Users.Attach(obj).Entity;

            _cinemaContext.Entry(obj).State = EntityState.Modified;

            return(updatedEntry);
        }
コード例 #3
0
        public async Task <Movie> ActivateCurrentMovie(Guid id)
        {
            var movie = await _cinemaContext.Movies.FindAsync(id);

            movie.Current = true;
            _cinemaContext.Entry(movie).State = EntityState.Modified;

            return(movie);
        }
コード例 #4
0
        public User AddPointsForUser(Guid userId, int numOfPoints)
        {
            var user = _cinemaContext.Users.Find(userId);

            user.Points = user.Points + numOfPoints;
            _cinemaContext.Entry(user).State = EntityState.Modified;

            return(user);
        }
コード例 #5
0
      public ActionResult Edit(Film film, int[] Countries, int[] Janrs)
      {
          var entity = context.Entry(film);

          entity.State = System.Data.Entity.EntityState.Modified;

          context.SaveChanges();
          DeleteRelationShip(film);

          foreach (var i in Countries)
          {
              FilmCountry filmCountry = new FilmCountry();
              filmCountry.FilmId    = film.Id;
              filmCountry.CountryId = i;
              context.FilmCountry.Add(filmCountry);

              context.SaveChanges();
          }
          foreach (var i in Janrs)
          {
              FilmJanr janr = new FilmJanr();

              janr.FilmId = film.Id;
              janr.JanrId = i;
              context.FilmJanr.Add(janr);
              context.SaveChanges();
          }
          return(RedirectToAction("Index"));
      }
コード例 #6
0
        public Ticket Update(Ticket obj)
        {
            var updateEntry = _cinemaContext.Tickets.Attach(obj).Entity;

            _cinemaContext.Entry(obj).State = EntityState.Modified;
            return(updateEntry);
        }
コード例 #7
0
        public async Task <IActionResult> PutCinema(int id, Cinema cinema)
        {
            if (id != cinema.Id)
            {
                return(BadRequest());
            }

            _context.Entry(cinema).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CinemaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #8
0
        public async Task <ActionResult> UpdateSeats([FromBody] List <Seat> seats)
        {
            foreach (var seat in seats)
            {
                seat.IsBooked = true;

                _context.Entry(seat).State = EntityState.Modified;

                try
                {
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SeatExists(seat.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            return(NoContent());
        }
コード例 #9
0
 public ActionResult Edit([Bind(Include = "ID,Title,Genre,ReleaseDate,Length,Directors,Actor,Intro,TrailerURL")] Movie movie, HttpPostedFileBase upload)
 {
     if (ModelState.IsValid)
     {
         var movieToUpdate = db.Movies.Find(movie.ID);
         if (upload != null && upload.ContentLength > 0)
         {
             db.Files.Remove(movieToUpdate.Files.First());
             var avatar = new File
             {
                 FileName    = System.IO.Path.GetFileName(upload.FileName),
                 ContentType = upload.ContentType
             };
             using (var reader = new System.IO.BinaryReader(upload.InputStream))
             {
                 avatar.Content = reader.ReadBytes(upload.ContentLength);
             }
             movieToUpdate.Files = new List <File> {
                 avatar
             };
         }
         db.Entry(movieToUpdate).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(movie));
 }
        public IHttpActionResult PutDirector(int id, Director director)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != director.Id)
            {
                return(BadRequest());
            }

            db.Entry(director).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DirectorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #11
0
        public City Update(City obj)
        {
            var updatedEntry = _cinemaContext.Cities.Attach(obj);

            _cinemaContext.Entry(obj).State = EntityState.Modified;

            return(updatedEntry.Entity);
        }
コード例 #12
0
        public Auditorium Update(Auditorium obj)
        {
            var updatedEntry = _cinemaContext.Auditoriums.Attach(obj);

            _cinemaContext.Entry(obj).State = EntityState.Modified;

            return(updatedEntry.Entity);
        }
コード例 #13
0
        public Seat Update(Seat obj)
        {
            var updatedEntry = _cinemaContext.Seats.Attach(obj).Entity;

            _cinemaContext.Entry(obj).State = EntityState.Modified;

            return(updatedEntry);
        }
コード例 #14
0
        public Reservation Update(Reservation obj)
        {
            var updatedEntry = _cinemaContext.Reservations.Attach(obj);

            _cinemaContext.Entry(obj).State = EntityState.Modified;

            return(updatedEntry.Entity);
        }
コード例 #15
0
        public Tag Update(Tag obj)
        {
            var updatedEntry = _cinemaContext.Tags.Attach(obj);

            _cinemaContext.Entry(obj).State = EntityState.Modified;

            return(updatedEntry.Entity);
        }
コード例 #16
0
        public Role Update(Role obj)
        {
            var updatedEntry = _cinemaContext.Roles.Attach(obj);

            _cinemaContext.Entry(obj).State = EntityState.Modified;

            return(updatedEntry.Entity);
        }
コード例 #17
0
        public Actor Update(Actor obj)
        {
            var updatedEntry = _cinemaContext.Actors.Attach(obj);

            _cinemaContext.Entry(obj).State = EntityState.Modified;

            return(updatedEntry.Entity);
        }
コード例 #18
0
        public Data.Cinema Update(Data.Cinema obj)
        {
            var updatedEntry = _cinemaContext.Cinemas.Attach(obj);

            _cinemaContext.Entry(obj).State = EntityState.Modified;

            return(updatedEntry.Entity);
        }
コード例 #19
0
        public Movie Update(Movie obj)
        {
            var updatedEntry = _cinemaContext.Movies.Attach(obj).Entity;

            _cinemaContext.Entry(obj).State = EntityState.Modified;

            return(updatedEntry);
        }
コード例 #20
0
        public Projection Update(Projection obj)
        {
            var updatedEntry = _cinemaContext.Projections.Attach(obj).Entity;

            _cinemaContext.Entry(obj).State = EntityState.Modified;

            return(updatedEntry);
        }
コード例 #21
0
ファイル: SalaController.cs プロジェクト: lvoc14/aula05
 public ActionResult Edit([Bind(Include = "SalaId,Numero,Capacidade,Descricao")] Sala sala)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sala).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sala));
 }
コード例 #22
0
 public ActionResult Edit([Bind(Include = "FilmeId,Titulo,Duracao")] Filme filme)
 {
     if (ModelState.IsValid)
     {
         db.Entry(filme).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(filme));
 }
コード例 #23
0
 public ActionResult Edit([Bind(Include = "Id,Godzina,Data,Opis,FilmId,SalaId")] Seans seans)
 {
     if (ModelState.IsValid)
     {
         db.Entry(seans).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(seans));
 }
コード例 #24
0
 public ActionResult Edit([Bind(Include = "OrderID,TotalPrice,Date_Of_Order")] Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(order));
 }
コード例 #25
0
 public ActionResult Edit([Bind(Include = "MovieID,Title,Length,Genra,year,ImageURI")] Movie movie)
 {
     if (ModelState.IsValid)
     {
         db.Entry(movie).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(movie));
 }
コード例 #26
0
 public ActionResult Edit([Bind(Include = "movieID,movieName,movieRating,movieAgeLimit,actors,movieScheduleID,ticketID")] Movie movie)
 {
     if (ModelState.IsValid)
     {
         db.Entry(movie).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(movie));
 }
コード例 #27
0
 public ActionResult Edit([Bind(Include = "ScreenID,ScreenNumber,Seats")] Screen screen)
 {
     if (ModelState.IsValid)
     {
         db.Entry(screen).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(screen));
 }
コード例 #28
0
ファイル: IngressoController.cs プロジェクト: lvoc14/aula05
 public ActionResult Edit([Bind(Include = "IngressoId,Tipo")] Ingresso ingresso)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ingresso).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ingresso));
 }
コード例 #29
0
 public ActionResult Edit([Bind(Include = "AtorId,AtorNome,FilmeId")] Ator ator)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ator).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ator));
 }
コード例 #30
0
 public ActionResult Edit([Bind(Include = "FilmeID,Film,Regizor,Rating,Ora,Data_Premiera,Data_Finala")] Filme filme)
 {
     if (ModelState.IsValid)
     {
         db.Entry(filme).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(filme));
 }