Example #1
0
        public ActionResult QoutesGridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Jarcet.Qoute.Web.Models.Qoutes item)
        {
            var model = new object[0];

            if (ModelState.IsValid)
            {
                try
                {
                    // Insert here a code to update the item in your model
                    unitOfWork.QoutesRepo.Update(item);
                    unitOfWork.Save();
                    QouteNotifierService qouteNotifierService = new QouteNotifierService(unitOfWork.QoutesRepo.Get(m => m.Id == item.Id, includeProperties: "Clients,QouteDetails,Users,QouteDetails.Products"), item.Subject, item.Subject, User.Identity.GetEmail());
                    INotifierService     notifier             = new EmailNotifierService(qouteNotifierService);
                    notifier.Send();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            return(PartialView("_QoutesGridViewPartial", model));
        }
Example #2
0
        public ActionResult QoutesGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Jarcet.Qoute.Web.Models.Qoutes item)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    item.Id = Guid.NewGuid().ToString();
                    foreach (var i in Session["QouteDetails"] as List <QouteDetails> )
                    {
                        i.Products = null;
                        item.QouteDetails.Add(i);
                    }
                    item.UserId = User.Identity.GetUserId();
                    unitOfWork.QoutesRepo.Insert(item);
                    unitOfWork.Save();

                    QouteNotifierService qouteNotifierService = new QouteNotifierService(unitOfWork.QoutesRepo.Get(m => m.Id == item.Id, includeProperties: "Clients,QouteDetails,Users,QouteDetails.Products"), item.Subject, item.Subject, User.Identity.GetEmail());
                    INotifierService     notifier             = new EmailNotifierService(qouteNotifierService);
                    notifier.Send();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            var model = unitOfWork.QoutesRepo.Get(includeProperties: "Clients");

            return(PartialView("_QoutesGridViewPartial", model));
        }