Exemple #1
0
        public ActionResult UpdateCalendarEvent(Calendar item)
        {
            bool res = true;

            try
            {
                using (AbcUEMDbEntities db = new AbcUEMDbEntities())
                {
                    if (item.start == null || item.end == null)
                    {
                        var obj = db.Calendar.Find(item.Id);
                        obj.TitleFr       = item.TitleFr;
                        obj.TitleMk       = item.TitleMk;
                        obj.DescriptionFr = item.DescriptionFr;
                        obj.DescriptionMk = item.DescriptionMk;
                        db.SaveChanges();
                    }
                    else
                    {
                        var obj = db.Calendar.Find(item.Id);
                        obj.start = item.start;
                        obj.end   = item.end;
                        db.SaveChanges();
                    }
                }
            }
            catch
            {
                res = false;
            }
            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Exemple #2
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 #3
0
        public ActionResult SaveImages(GalleryDetails item)
        {
            bool res = true;

            try
            {
                using (AbcUEMDbEntities db = new AbcUEMDbEntities())
                {
                    if (!Directory.Exists(Server.MapPath("~/Images/Gallery/Details")))
                    {
                        Directory.CreateDirectory(Server.MapPath("~/Images/Gallery/Details"));
                    }

                    HttpPostedFileBase file = Request.Files[0];

                    var i = db.GalleryDetails.Add(item);
                    db.SaveChanges();
                    string extension = Path.GetExtension(file.FileName);

                    var path = Path.Combine(Server.MapPath("~/Images/Gallery/Details/"), i.Id + ".jpg");

                    file.SaveAs(path);
                }
            }
            catch
            {
                res = false;
            }
            return(Json(item.GalleryMasterId, JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        public ActionResult DeleteGalery(GalleryMaster item)
        {
            bool res = true;

            try
            {
                using (AbcUEMDbEntities db = new AbcUEMDbEntities())
                {
                    db.GalleryMaster.Remove(db.GalleryMaster.Find(item.Id));
                    var pathMaster = Server.MapPath("~/Images/Gallery/Master/" + item.Id + ".jpg");
                    if (System.IO.File.Exists(pathMaster))
                    {
                        System.IO.File.Delete(pathMaster);
                    }
                    foreach (var i in db.GalleryDetails.Where(x => x.GalleryMasterId == item.Id))
                    {
                        var pathDetails = Server.MapPath("~/Images/Gallery/Details/" + i.Id + ".jpg");
                        if (System.IO.File.Exists(pathDetails))
                        {
                            System.IO.File.Delete(pathDetails);
                        }
                        db.GalleryDetails.Remove(db.GalleryDetails.Find(i.Id));
                    }
                    db.SaveChanges();
                }
            }
            catch
            {
                res = false;
            }
            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Exemple #5
0
 public ActionResult DeleteContent(Translates item)
 {
     using (AbcUEMDbEntities db = new AbcUEMDbEntities())
     {
         bool res = true;
         try
         {
             db.Translates.Remove(db.Translates.Find(item.Id));
             db.SaveChanges();
         }
         catch
         {
             res = false;
         }
         return(Json(res, JsonRequestBehavior.AllowGet));
     }
 }
Exemple #6
0
        public ActionResult DeleteCalendarEvent(Calendar item)
        {
            bool res = true;

            try
            {
                using (AbcUEMDbEntities db = new AbcUEMDbEntities())
                {
                    db.Calendar.Remove(db.Calendar.Find(item.Id));
                    db.SaveChanges();
                }
            }
            catch
            {
                res = false;
            }
            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Exemple #7
0
        public ActionResult AddContent(Translates item)
        {
            bool res = true;

            try
            {
                using (AbcUEMDbEntities db = new AbcUEMDbEntities())
                {
                    db.Translates.Add(item);
                    db.SaveChanges();
                }
            }
            catch
            {
                res = false;
            }
            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Exemple #8
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));
        }