Ejemplo n.º 1
0
        public ActionResult New(KeywordVm vm)
        {
            try
            {
                var keyword = new OpenModelKeyword
                {
                    Id             = Guid.NewGuid(),
                    CreatedAt      = DateTime.Now,
                    CreatedBy      = LoggedInUser.Id,
                    Keyword        = vm.Keyword,
                    RulePercentage = vm.RulePercentage,
                };
                Db.OpenModelKeywords.Add(keyword);
                Db.SaveChanges();

                //SetForceCustomers(true);

                TempData["Success"] = "New Keyword has been added successfully!";
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                //
            }
            return(View("Error"));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(KeywordVm vm)
        {
            try
            {
                var keyword = Db.OpenModelKeywords.Find(Guid.Parse(vm.Id));
                if (keyword != null)
                {
                    keyword.Keyword        = vm.Keyword;
                    keyword.RulePercentage = vm.RulePercentage;
                }
                Db.SaveChanges();
                TempData["Success"] = "Keyword has been updated successfully!";

                //SetForceCustomers(true);
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                // ignored
            }
            return(View("Error"));
        }
Ejemplo n.º 3
0
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                throw new HttpException(400, "Bad Request");
            }
            var x = Db.OpenModelKeywords.Find(id);

            if (x == null)
            {
                throw new HttpException(404, "Not found");
            }
            var vm = new KeywordVm
            {
                Id             = x.Id.ToString(),
                Keyword        = x.Keyword,
                RulePercentage = x.RulePercentage,
                DateCreated    = x.CreatedAt.ToString()
            };

            //ViewBag.ReportTemplate = new SelectList(ReportTemplates, "Value", "Text", customerVm.ReportTemplate);
            return(View("New", vm));
        }