예제 #1
0
        public override System.Web.Mvc.ActionResult Edit(Models.NewsComments newsComments)
        {
            var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit);

            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "newsComments", newsComments);
            EditOverride(callInfo, newsComments);
            return(callInfo);
        }
예제 #2
0
        public virtual System.Web.Mvc.ActionResult Edit(Models.NewsComments newsComments)
        {
            newsComments.UpdateDateTime = Infrastructure.Utility.Now;

            if (ModelState.IsValid)
            {
                UnitOfWork.NewsCommentsRepository.Update(newsComments);

                UnitOfWork.Save();
                if (newsComments.IsActive)
                {
                    try
                    {
                        System.Net.Mail.MailMessage msg  = new System.Net.Mail.MailMessage();
                        System.Net.Mail.MailAddress from = new System.Net.Mail.MailAddress("*****@*****.**", "وب سایت رسمی ناصر فروتن", System.Text.Encoding.UTF8);
                        System.Net.Mail.MailAddress to   = new System.Net.Mail.MailAddress(newsComments.Email, "وب سایت رسمی ناصر فروتن", System.Text.Encoding.UTF8);

                        msg.Subject         = "تائید نظر شما";
                        msg.SubjectEncoding = System.Text.Encoding.UTF8;
                        msg.Body            = "کابر گرامی" + " " + newsComments.Username + " " + "با تشکر از  شما ، نظر شما در سایت قرار گرفت" + "\n\r" +
                                              "وب سایت رسمی داور بین المللی کشتی ناصر فروتن";
                        msg.BodyEncoding = System.Text.Encoding.UTF8;
                        msg.From         = from;
                        msg.To.Add(to);


                        System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
                        //  smtp.Host = "smtp.mail.yahoo.com";
                        //  "mail.pap-ict.ir";
                        smtp.Host        = "smtp.gmail.com";
                        smtp.Port        = 587;
                        smtp.Timeout     = 36000;
                        smtp.EnableSsl   = true;
                        smtp.Credentials = new NetworkCredential("*****@*****.**", "naserforoutan1397");
                        smtp.Send(msg);
                    }
                    catch (System.Exception)
                    {
                        return(RedirectToAction(MVC.NewsComments.Index()));
                    }
                }
                return(RedirectToAction(MVC.NewsComments.Index()));
            }

            ViewBag.NewsId =
                new System.Web.Mvc.SelectList
                    (UnitOfWork.NewsRepository.Get(), "Id", "Title", newsComments.NewsId);

            return(View(newsComments));
        }
예제 #3
0
        public virtual System.Web.Mvc.ActionResult DeleteConfirmed(System.Guid id)
        {
            Models.NewsComments oNewsComments =
                UnitOfWork.NewsCommentsRepository.Get()
                .Where(current => current.Id == id)
                .FirstOrDefault()
            ;

            UnitOfWork.NewsCommentsRepository.Delete(oNewsComments);

            UnitOfWork.Save();

            return(RedirectToAction(MVC.NewsComments.Index()));
        }
예제 #4
0
        public virtual System.Web.Mvc.ActionResult Details(System.Guid id)
        {
            Models.NewsComments oNewsComments =
                UnitOfWork.NewsCommentsRepository.Get()
                .Where(current => current.Id == id)
                .FirstOrDefault()
            ;

            if (oNewsComments == null)
            {
                return(HttpNotFound());
            }

            return(View(oNewsComments));
        }
예제 #5
0
        public virtual System.Web.Mvc.ActionResult Edit(System.Guid id)
        {
            Models.NewsComments oNewsComments =
                UnitOfWork.NewsCommentsRepository.Get()
                .Where(current => current.Id == id)
                .FirstOrDefault()
            ;

            if (oNewsComments == null)
            {
                return(HttpNotFound());
            }

            ViewBag.NewsId =
                new System.Web.Mvc.SelectList
                    (UnitOfWork.NewsRepository.Get(), "Id", "Title", oNewsComments.NewsId);

            return(View(oNewsComments));
        }
예제 #6
0
        public virtual System.Web.Mvc.ActionResult Create(System.Guid newsId, string username, string description, string email)
        {
            var oNewsId =
                UnitOfWork.NewsRepository.Get()
                .Where(current => current.Id == newsId)
                .FirstOrDefault()
            ;

            Models.NewsComments newsComments = new Models.NewsComments
            {
                Id          = System.Guid.NewGuid(),
                Description = description,
                Email       = email,
                NewsId      = newsId,
                IsActive    = false,
                Username    = username
            };
            UnitOfWork.NewsCommentsRepository.Insert(newsComments);
            UnitOfWork.Save();
            //        return (View(newsComments));
            return(Json(true));
        }
예제 #7
0
 partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Models.NewsComments newsComments);