Exemplo n.º 1
0
        public ActionResult Edit(ContentViewModel obj)
        {
            try
            {
                using (ShoppingCartAppEntities db = new ShoppingCartAppEntities())
                {
                    HttpPostedFileBase file    = Request.Files["ImageData"];
                    ContentRepository  service = new ContentRepository();

                    int i = service.AddUpdateConttentData(file, obj); if (i == 1)
                    {
                        return(RedirectToAction("Display"));
                    }
                    db.SaveChanges();
                    return(RedirectToAction("Display"));
                }
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Login"));
            }
        }
Exemplo n.º 2
0
 public ActionResult Create(ContentViewModel model)
 {
     try
     {
         int UserId = Convert.ToInt32(Session["UserId"].ToString());
         if (UserId != null)
         {
             HttpPostedFileBase file    = Request.Files["ImageData"];
             ContentRepository  service = new ContentRepository();
             int i = service.AddUpdateConttentData(file, model);
             if (i == 1)
             {
                 return(RedirectToAction("Display"));
             }
             return(View(model));
         }
         return(RedirectToAction("Login"));
     }
     catch (Exception ex)
     {
         return(RedirectToAction("Login"));
     }
 }