Пример #1
0
 public ActionResult Edit(int id, Movie c)
 {
     try
     {
         using (MovieDal mdb = new MovieDal())
         {
             c.Picture          = "~/UploadedFiles/" + c.Picture.ToString();
             mdb.Entry(c).State = EntityState.Modified;
             mdb.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Пример #2
0
 public ActionResult PutOnSale(int id, int sale)
 {
     try
     {
         using (MovieDal mdb = new MovieDal())
         {
             Movie c = mdb.Movies.Where(x => x.mid == id).FirstOrDefault();
             c.Sale             = sale;
             mdb.Entry(c).State = EntityState.Modified;
             mdb.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }