Example #1
0
        public JsonResult AddEditImage(AddUpdateAdminImageModel model)
        {
            model.ByAdmin = false;
            model.AddedBy = LOGGEDIN_USER.UserID;
            var result = _imageManager.AddUpdateAdminImage(model);

            return(JsonResult(result));
        }
Example #2
0
        public ActionResult Dashboard1()
        {
            var UploadModel = new AddUpdateAdminImageModel();

            UploadModel.Categories = _imageManager.GetImageCategoryDDLList();
            ViewBag.UploadModel    = UploadModel;
            return(View());
        }
Example #3
0
        public ActionResult AddAdminImage(int?id)
        {
            ViewBag.SelectedTab = SelectedAdminTab.Images;
            var model = new AddUpdateAdminImageModel();

            if (id != null)
            {
                model = _imageManager.GetAdminImageById(Convert.ToInt32(id));
            }
            model.Categories = _imageManager.GetImageCategoryDDLList();
            return(View(model));
        }
Example #4
0
        public ActionResult GetUserDashboardForApp(string Token, int cardid)
        {
            var userid = _userManager.GetSessionByToken(Token);

            if (userid > 0)
            {
                var userCards = _userManager.GetUserCardStatus(userid);
                ViewBag.StepGuidanceStatus = _userManager.GetUserCardStepGuidance(userid);
                if (userCards.Status == ActionStatus.Successfull)
                {
                    var UploadModel = new AddUpdateAdminImageModel();
                    var editorModel = new AddUpdateImageEditorModel();
                    if (cardid > 0)
                    {
                        var existRecord = _editorManager.GetPostCardDetailsByID(Convert.ToInt32(cardid), userid);
                        if (existRecord.Status == ActionStatus.Successfull)
                        {
                            if (!existRecord.Object.IsOrderPlaced)
                            {
                                editorModel = existRecord.Object;
                            }
                        }
                        else
                        {
                            return(RedirectToAction("GetUserDashboardForApp", "Home", new { Token = Token, cardid = 0 }));
                        }
                    }
                    UploadModel.Categories = _imageManager.GetImageCategoryDDLList();
                    ViewBag.UploadModel    = UploadModel;
                    ActionOutput <ImagesByCategoryViewModel> modal = _imageManager.GetImagesByCategoryWise(userid);
                    ViewBag.RecentlyUsedImageList = _imageManager.GetImagesByCategoryWise(userid, "").List.Where(x => x.IsRecent).ToList();
                    ViewBag.OrderID = cardid;
                    if (cardid > 0)
                    {
                        editorModel.ID = Convert.ToInt32(cardid);
                    }
                    return(View(editorModel));
                }
                else
                {
                    TempData["Msg"] = "Greetings! You have used up all your tokens.Would you like to purchase a membership?";
                    return(RedirectToAction("ErrorPage"));
                }
            }
            else
            {
                TempData["Msg"] = "Invalid User";
                return(RedirectToAction("ErrorPage"));
            }
        }
Example #5
0
        AddUpdateAdminImageModel IImageManager.GetAdminImageById(int id)
        {
            var model    = new AddUpdateAdminImageModel();
            var existing = Context.AdminImages.FirstOrDefault(z => z.ID == id);

            if (existing != null)
            {
                return(model = Mapper.Map <AdminImage, AddUpdateAdminImageModel>(existing));
            }
            else
            {
                return(null);
            }
        }
Example #6
0
        //
        // GET: /User/Home/
        public ActionResult Dashboard(int?cid)
        {
            var  changeTempUserId = LOGGEDIN_USER.UserID;
            bool IsCopy           = false;

            ViewBag.IsCopyCard = false;
            if (Session["CardID"] != null)
            {
                IsCopy             = true;
                ViewBag.IsCopyCard = true;
                cid = (int)Session["CardID"];
                Session.Remove("CardID");
            }

            if (Session["DemoCardUserId"] != null)
            {
                var userId = (int)Session["DemoCardUserId"];

                if (userId > 0)
                {
                    changeTempUserId   = userId;
                    ViewBag.IsCopyCard = true;
                    Session.Remove("DemoCardUserId");
                }
            }

            var userCards = _userManager.GetUserCardStatus(changeTempUserId);

            ViewBag.StepGuidanceStatus = _userManager.GetUserCardStepGuidance(changeTempUserId);
            if (userCards.Status == ActionStatus.Successfull)
            {
                var UploadModel = new AddUpdateAdminImageModel();
                var editorModel = new AddUpdateImageEditorModel();
                if (cid > 0 && cid != null)
                {
                    var existRecord = _editorManager.GetPostCardDetailsByID(Convert.ToInt32(cid), changeTempUserId);
                    if (existRecord.Status == ActionStatus.Successfull)
                    {
                        if (existRecord.Object.IsOrderPlaced)
                        {
                            //  return RedirectToActionPermanent("PostCards", "PostCard", new { Area = "User" });

                            //cid = null;
                            editorModel        = existRecord.Object;
                            ViewBag.IsCopyCard = true;
                        }
                        else
                        {
                            editorModel = existRecord.Object;
                        }
                    }
                    else
                    {
                        return(RedirectToAction("Dashboard", "Home"));
                    }
                }
                UploadModel.Categories = _imageManager.GetImageCategoryDDLList();
                ViewBag.UploadModel    = UploadModel;
                // ActionOutput<ImagesByCategoryViewModel> modal = _imageManager.GetImagesByCategoryWise(LOGGEDIN_USER.UserID);
                //ViewBag.RecentlyUsedImageList = _imageManager.GetImagesByCategoryWise(LOGGEDIN_USER.UserID, "").List.Where(x => x.IsRecent).ToList();
                var cardlList = _editorManager.GetDemoPostCardListing();
                if (cardlList.List != null)
                {
                    ViewBag.AdminCards = _editorManager.GetDemoPostCardListing().List;
                }
                else
                {
                    ViewBag.AdminCards = new List <AddUpdateImageEditorModel>();
                }

                ViewBag.OrderID = cid;
                if (cid > 0 && cid != null && IsCopy != true)
                {
                    editorModel.ID = Convert.ToInt32(cid);
                }

                return(View(editorModel));
            }
            else
            {
                TempData["CardMessage"] = userCards.Message;
                return(RedirectToAction("PaymentPlans", "Payment", new { area = "User" }));
            }
        }
Example #7
0
        ActionOutput IImageManager.AddUpdateAdminImage(AddUpdateAdminImageModel model)
        {
            var existingImage = Context.AdminImages.FirstOrDefault(z => z.ID == model.ID);

            if (existingImage == null)
            {
                var newRecord = new AdminImage();
                newRecord = Mapper.Map <AddUpdateAdminImageModel, AdminImage>(model);
                foreach (var item in model.Image)
                {
                    if (item.ContentLength > 524288)  // 500kb
                    {
                        return(new ActionOutput
                        {
                            Status = ActionStatus.Error,
                            Message = "Upload file of size up to 500kb only"
                        });
                    }
                    //  var fileUName = Utilities.SavePostedFile(AttacmentsPath.AdminImages + "/", item);
                    var saveFileWithThumb = Utilities.SaveImage(item, AttacmentsPath.AdminImages, AttacmentsPath.AdminImagesThumb);
                    newRecord.FilePath    = AttacmentsPath.AdminImages + saveFileWithThumb;
                    newRecord.FileName    = Path.GetFileNameWithoutExtension(saveFileWithThumb);
                    newRecord.Description = model.Description;
                    newRecord.ActivatedOn = DateTime.UtcNow;
                    newRecord.AddedOn     = DateTime.UtcNow;
                    newRecord.IsDeleted   = false;
                    newRecord.IsActive    = true;
                    Context.AdminImages.Add(newRecord);
                }
                Context.SaveChanges();
                return(new ActionOutput
                {
                    Status = ActionStatus.Successfull,
                    Message = "Image Added Sucessfully."
                });
            }
            else
            {
                // existingImage = Mapper.Map<AddUpdateAdminImageModel, AdminImage>(model);
                existingImage.CategoryID  = model.CategoryID;
                existingImage.Description = model.Description;
                if (model.Image != null)
                {
                    foreach (var item in model.Image)
                    {
                        if (item.ContentLength > 524288)  // 500kb
                        {
                            return(new ActionOutput
                            {
                                Status = ActionStatus.Error,
                                Message = "Upload file of size up to 500kb only"
                            });
                        }
                        //  var fileUName = Utilities.SavePostedFile(AttacmentsPath.AdminImages + "/", item);
                        var saveFileWithThumb = Utilities.SaveImage(item, AttacmentsPath.AdminImages, AttacmentsPath.AdminImagesThumb);
                        existingImage.FileName = Path.GetFileNameWithoutExtension(saveFileWithThumb);
                        existingImage.FilePath = AttacmentsPath.AdminImages + saveFileWithThumb;
                    }
                }
                Context.SaveChanges();
                return(new ActionOutput
                {
                    Status = ActionStatus.Successfull,
                    Message = "Image Updated Sucessfully."
                });
            }
        }