Example #1
0
        public ActionResult _DeleteConfirmed(int id)
        {
            CImage image       = context.FindPhotoById(id);
            var    myImageType = image.type;

            context.Delete <CImage>(image);
            context.SaveChanges();

            var myImageLibModel = GetLatestImageLibrary(myImageType);

            return(PartialView("_ImageLibrary", myImageLibModel));
        }
        public ActionResult _DeleteEvent(int id)
        {
            CEvent myEvent = context.FindEventById(id);

            //check for recurrane ref
            if (myEvent.recurranceRef != null)
            {
                myEvent.cancelled = true;
                context.SaveChanges();
            }
            else
            {
                context.Delete <CEvent>(myEvent);
                context.SaveChanges();
            }
            var redirectUrl = new UrlHelper(Request.RequestContext).Action("Index", "Home");

            return(Json(new { Url = redirectUrl }));
        }