public ActionResult Edit(Genre genre, FormCollection collection)
 {
     if (ModelState.IsValid)
     {
         fac.GetGenryRepository().UpdateGenre(genre);
         return RedirectToAction("Index");
     }
         return View();
 }
        public void Add(Genre genre)
        {
            using (var ctx = new MovieStoreContext())
            {

                ctx.Genres.Add(genre);
                ctx.SaveChanges();
            }
        }
 public void UpdateGenre(Genre genre)
 {
     using (var ctx = new MovieStoreContext())
     {
         Genre m = ctx.Genres.Where(x => x.Id == genre.Id).First();
         m.Id = genre.Id;
         m.Name = genre.Name;
         ctx.SaveChanges();
     }
 }