public async Task <ActionResult> AddUpdateGame(DIBZ.Common.Model.GameCatalog request, HttpPostedFileBase file)
        {
            var gameCatalogLogic = LogicContext.Create <GameCatalogLogic>();

            var    serverPath = Server.MapPath("~/Uploads");
            string fileName   = string.Empty;

            if (file != null)
            {
                fileName = file.FileName;
            }
            var gameData = await gameCatalogLogic.AddUpdate(request, fileName);

            if (file != null)
            {
                var fileSizeInMB = file.ContentLength / 1024;
                var savePath     = Path.Combine(serverPath, gameData.GameImage.Id.ToString());
                if (fileSizeInMB >= 1024 * 1.65)
                {
                    var originalFilePath = Path.Combine(serverPath, (gameData.GameImage.Id + 100).ToString());
                    file.SaveAs(originalFilePath);
                    FileSaveHelper.ResizeTo(originalFilePath, 865, 500, savePath);
                    System.IO.File.Delete(originalFilePath);
                }
                else
                {
                    file.SaveAs(savePath);
                }
            }

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> AddUpdateContent(FormCollection formData, HttpPostedFileBase file)
        {
            var    serverPath      = Server.MapPath("~/Uploads");
            string fileNewName     = string.Empty;
            string fileOrignalName = string.Empty;
            int    isUploaded      = 0;

            if (file != null)
            {
                Random rnd          = new Random();
                int    rendomNumber = rnd.Next(52);
                string extension    = Path.GetExtension(file.FileName);
                var    filename     = Path.GetFileNameWithoutExtension(file.FileName);
                fileNewName     = filename + rendomNumber + extension;
                fileOrignalName = file.FileName;

                var fileSizeInMB = file.ContentLength / 1024;
                var savePath     = Path.Combine(serverPath, fileNewName.ToString());
                if (fileSizeInMB >= 1024 * 1.65)
                {
                    var originalFilePath = Path.Combine(serverPath, (fileNewName).ToString());
                    file.SaveAs(originalFilePath);
                    FileSaveHelper.ResizeTo(originalFilePath, 865, 500, savePath);
                    System.IO.File.Delete(originalFilePath);
                    isUploaded = 1;
                }
                else
                {
                    file.SaveAs(savePath);
                    isUploaded = 1;
                }
            }

            int id = Convert.ToInt32(formData["Id"]);
            var newsFeedLogicLogic = LogicContext.Create <CompetitionLogic>();

            DIBZ.Common.Model.Competition request = new Common.Model.Competition();
            request.Id      = id;
            request.Name    = formData["txtname"];
            request.Title   = formData["txttitle"];
            request.Content = formData["txtcontent"];
            if (isUploaded == 1)
            {
                request.FileNewName     = fileNewName;
                request.FileOrignalName = fileOrignalName;
            }
            else
            {
                request.FileNewName     = "";
                request.FileOrignalName = "";
            }
            var status = formData["status"];

            if (status == "1")
            {
                request.IsActive = true;
            }
            else
            {
                request.IsActive = false;
            }

            await newsFeedLogicLogic.AddUpdate(request);

            return(RedirectToAction("Index"));
        }