Beispiel #1
0
        public ActionResult Create(FormCollection collection)
        {
            var gallery = new Radyn.Gallery.DataStructure.Gallery();

            try
            {
                this.RadynTryUpdateModel(gallery);
                HttpPostedFileBase image = null;
                gallery.CurrentUICultureName = collection["LanguageId"];
                if (Session["Image"] != null)
                {
                    image = (HttpPostedFileBase)Session["Image"];
                    Session.Remove("Image");
                }
                if (WebDesignComponent.Instance.GalleryFacade.Insert(this.WebSite.Id, gallery, image))
                {
                    ShowMessage(Resources.Common.InsertSuccessMessage, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Succeed);
                    return(RedirectToAction("Index"));
                }
                ShowMessage(Resources.Common.ErrorInInsert, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Error);
                return(RedirectToAction("Index"));
            }
            catch (Exception exception)
            {
                ShowMessage(Resources.Common.ErrorInInsert + exception.Message, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Error);
                TempData["ParentGallery"] = new SelectList(WebDesignComponent.Instance.GalleryFacade.GetParents(this.WebSite.Id), "Id", "Title");
                return(View(gallery));
            }
        }
Beispiel #2
0
        public ActionResult Create(FormCollection collection)
        {
            var gallery = new Radyn.Gallery.DataStructure.Gallery();

            try
            {
                this.RadynTryUpdateModel(gallery);
                gallery.CreateDate = DateTime.Now.ShamsiDate();
                HttpPostedFileBase image = null;
                gallery.CurrentUICultureName = collection["LanguageId"];
                if (Session["Image"] != null)
                {
                    image = (HttpPostedFileBase)Session["Image"];
                    Session.Remove("Image");
                }
                List <HttpPostedFileBase> fileBases = null;

                if (Session["PhotoList"] != null)
                {
                    fileBases = (List <HttpPostedFileBase>)Session["PhotoList"];
                    Session.Remove("PhotoList");
                }
                if (CongressComponent.Instance.BaseInfoComponents.CongessGalleryFacade.Insert(this.Homa.Id, gallery, image, fileBases))
                {
                    ShowMessage(Resources.Common.InsertSuccessMessage, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Succeed);
                    return(this.SubmitRedirect(collection, new { Id = gallery.Id }));
                }
                ShowMessage(Resources.Common.ErrorInInsert, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Error);
                return(Redirect("~/Congress/CongressGallery/Index"));
            }
            catch (Exception exception)
            {
                ShowExceptionMessage(exception);
                TempData["ParentGallery"] = new SelectList(CongressComponent.Instance.BaseInfoComponents.CongessGalleryFacade.GetParents(this.Homa.Id), "Key", "Value");
                return(View(gallery));
            }
        }