public ActionResult Index(FormCollection frmCollection, HttpPostedFileBase files)
        {
            InzPost _post = new InzPost
            {
                Title          = frmCollection["PostTitle"].ToString(),
                SubDescription = frmCollection["SubDescription"].ToString(),
                Category       = frmCollection["Category"].ToString(),
                Description    = frmCollection["Description"],
                IsPublic       = frmCollection["Privacy"].ToString() == "Public"?1:0,
                ReferenceURL   = frmCollection["ReferenceURL"].ToString(),
                UserId         = USerConfig.GetUserID(),
                FileName       = files.FileName.ToString()
            };

            if (files != null)
            {
                if (files.ContentLength > 0)
                {
                    var fileName = Path.GetFileName(files.FileName);

                    var path = Path.Combine(Server.MapPath("~/PostImage"), fileName);
                    files.SaveAs(path);
                }
            }


            Dictionary <int, string> Response = ObjPostSericeLayer.SavePost(_post);


            string getResponse           = "";
            int    GetPostIdAsReturnCode = 0;

            foreach (var pair in Response)
            {
                GetPostIdAsReturnCode = pair.Key;
                getResponse           = pair.Value;
            }

            FileDataLayer objFileDataLayer = new FileDataLayer();

            objFileDataLayer.SaveFile(USerConfig.GetUserID(), GetPostIdAsReturnCode);

            TempData["AlertMessage"] = getResponse;
            ViewBag.Categories       = ObjPostSericeLayer.GetCategories();
            if (GetPostIdAsReturnCode != -1 || GetPostIdAsReturnCode != -2)
            {
                InzPost SavedPost = new InzPost();
                SavedPost.PostId = GetPostIdAsReturnCode;
                return(View());
            }
            else
            {
                return(View());
            }
        }
예제 #2
0
        public ActionResult ViewPartner(FormCollection PostData)
        {
            FileDataLayer fileDLayer = new FileDataLayer();
            int           FileId     = int.Parse(PostData["FileId"]);
            int           UserId     = int.Parse(PostData["UserId"]);
            bool          Response   = fileDLayer.UpdatePartnerStatus(FileId, UserId);

            if (Response)
            {
                TempData["AlertMessage"] = "Sucess";
            }
            else
            {
                TempData["AlertMessage"] = "Error";
            }

            return(RedirectToAction("Index"));
        }
예제 #3
0
        public ActionResult AddPartners(FormCollection frmCollection)
        {
            int FileId    = Convert.ToInt32(frmCollection["FileId"]);
            int PartnerId = Convert.ToInt32(frmCollection["PartnerId"]);

            FileDataLayer fileDatalayer = new FileDataLayer();

            FileResponse FileResponse = fileDatalayer.SaveFile(PartnerId, FileId);

            if (FileResponse.Status == FileStatus.Sucess)
            {
                TempData["AlertMessage"] = "Sucess";
            }
            else
            {
                TempData["AlertMessage"] = "Error";
            }
            return(RedirectToAction("Index"));
        }