Exemplo n.º 1
0
 public void AddActor(Actor actorToAdd)
 {
     using (var db = new MovieReviewsEntities())
     {
         db.Actors.Add(actorToAdd);
         db.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public ActionResult Edit(Actor actor)
 {
     if (ModelState.IsValid)
     {
         actorActionEvent.UpdateActor(actor);
         return RedirectToAction("Index", new { idOfChangedActor = actor.ActorID });
     }
     return View(actor);
 }
Exemplo n.º 3
0
 public void UpdateActor(Actor actorToEdit)
 {
     using (var db = new MovieReviewsEntities())
         {
             db.Actors.Attach(actorToEdit);
             db.Entry<Actor>(actorToEdit).State = System.Data.EntityState.Modified;
             db.SaveChanges();
         }
 }
Exemplo n.º 4
0
        public ActionResult Edit(int id)
        {
            actor = actorActionEvent.Find(id);

            if (actor == null)
            {
                return HttpNotFound();
            }

            return View(actor);
        }
Exemplo n.º 5
0
 public void DeleteActor(int actorId)
 {
     using (var db = new MovieReviewsEntities())
     {
         var actorToDelete = new Actor
         {
             ActorID = actorId
         };
         db.Actors.Attach(actorToDelete);
         db.Actors.Remove(actorToDelete);
         db.SaveChanges();
     }
 }
Exemplo n.º 6
0
 public ActionResult DeleteConfirmation(int actorId)
 {
     actor = actorActionEvent.Find(actorId);
     return View(actor);
 }
Exemplo n.º 7
0
 public ActionResult Add(Actor model)
 {
     actorActionEvent.AddActor(model);
     return RedirectToAction("index", new { idOfChangedActor = model.ActorID });
 }