Exemple #1
0
        public ActionResult Paylas(Share share)
        {
            if (ModelState.IsValid)
            {
                share.Owner       = CurrentSession.User;
                share.CreatedDate = DateTime.Now;
                shareManager.Insert(share);
                return(RedirectToAction("Index", "Home"));
            }

            return(View(share));
        }
        public ActionResult Paylas(Share share)
        {
            if (ModelState.IsValid)
            {
                share.Owner        = CurrentSession.footballer;
                share.ModifiedDate = DateTime.Now;
                share.CreatedDate  = DateTime.Now;
                shareManager.Insert(share);
                return(RedirectToAction("ShowFootballerProfile", "Home"));
            }

            return(View(share));
        }
        public ActionResult Create(Share share, HttpPostedFileBase image)
        {
            if (ModelState.IsValid)
            {
                //image Upload
                string fileName  = Path.GetFileNameWithoutExtension(image.FileName);
                string extension = Path.GetExtension(image.FileName);
                fileName = fileName + DateTime.Now.ToString("yymmsfff") + extension;
                share.ShareImageFileName = fileName;
                fileName = Path.Combine(Server.MapPath("~/images/"), fileName);
                image.SaveAs(fileName);
                //if (image != null &&
                //        (image.ContentType == "image/jpeg" ||
                //        image.ContentType == "image/jpg" ||
                //        image.ContentType == "image/png"))
                //{
                //    string filename = $"footballerShare_{share.ShareId}.{image.ContentType.Split('/')[1]}";

                //    image.SaveAs(Server.MapPath($"~/images/{filename}"));
                //    share.ShareImageFileName = filename;

                //Video Upload



                share.Owner        = CurrentSession.footballer;
                share.ModifiedDate = DateTime.Now;
                share.CreatedDate  = DateTime.Now;

                shareManager.Insert(share);
                return(RedirectToAction("ShowFootballerProfile", "Home"));
            }



            return(View(share));
        }
        public bool Save(ShareEntity share)
        {
            _manager.ClearBrokenRuleMessages();
#if !DEBUG
            using (TransactionScope tran = new TransactionScope())
            {
#endif
            bool result = false;
            if (share.Type == 0)
            {
                share.TypeEntity.CreatedBy = share.CreatedBy;
                share.TypeEntity.CreatedOn = DateTime.Now;
                result = _manager.InsertType(share.TypeEntity);
                if (!result)
                {
                    this.AddBrokenRuleMessages(_manager.BrokenRuleMessages);
                    return(false);
                }
                share.Type = share.TypeEntity.ID;
            }
            if (share.ID < 1)
            {
                result = _manager.Insert(share);
            }
            else
            {
                result = _manager.Update(share);
            }
            if (!result)
            {
                this.AddBrokenRuleMessages(_manager.BrokenRuleMessages);
                return(false);
            }
#if !DEBUG
            tran.Complete();
        }
#endif
            return(true);
        }