Exemple #1
0
        public ActionResult UpdateSubGaleryImage(GalleryDetails item)
        {
            bool res = true;

            try
            {
                using (AbcUEMDbEntities db = new AbcUEMDbEntities())
                {
                    HttpPostedFileBase file = Request.Files[0];
                    if (file.ContentLength > 0)
                    {
                        var path = Server.MapPath("~/Images/Gallery/Details/" + item.Id + ".jpg");
                        if (System.IO.File.Exists(path))
                        {
                            System.IO.File.Delete(path);
                        }
                        file.SaveAs(path);
                    }

                    var obj = db.GalleryDetails.Find(item.Id);
                    db.Entry(obj).CurrentValues.SetValues(item);
                    db.SaveChanges();
                }
            }
            catch
            {
                res = false;
            }
            return(Json(item.GalleryMasterId, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public ActionResult UpdateContent(Translates item)
        {
            bool res = true;

            try
            {
                using (AbcUEMDbEntities db = new AbcUEMDbEntities())
                {
                    var obj = db.Translates.Find(item.Id);
                    db.Entry(obj).CurrentValues.SetValues(item);
                    db.SaveChanges();
                }
            }
            catch
            {
                res = false;
            }
            return(Json(res, JsonRequestBehavior.AllowGet));
        }