Exemplo n.º 1
0
        public IActionResult RevCreate(TPReview rev, int Pid, string actionType)
        {
            if (actionType == "Add")
            {
                if (ModelState.IsValid)
                {
                    try{
                        _dbContext.TPReviews.Add(rev);
                        _dbContext.SaveChanges();
                    }
                    catch { return(View("Error")); }
                }
                else
                {
                    loadPersonViewBag(Pid);
                    return(View(rev));
                }
            }
            var model = _dbContext.TPersons
                        .SingleOrDefault(u => u.PerId.Equals(Pid));

            CreateViewBags(Pid);
            ViewData["panel"] = 7;
            return(View("Edit", model));
        }
Exemplo n.º 2
0
        public IActionResult RevEdit(TPReview rev, string actionType)
        {
            int?Pid = rev.RevPerId;

            if (actionType == "Update")
            {
                if (ModelState.IsValid)
                {
                    try{
                        _dbContext.TPReviews.Update(rev);
                        _dbContext.SaveChanges();
                    }
                    catch {}
                }
                else
                {
                    loadPersonViewBag(Pid);
                    return(View(rev));
                }
            }
            var model = _dbContext.TPersons
                        .SingleOrDefault(u => u.PerId.Equals(Pid));

            CreateViewBags(Pid);
            ViewData["panel"] = 7;
            return(View("Edit", model));

            //return RedirectToAction("Index");
        }
Exemplo n.º 3
0
        public IActionResult RevCreate(TPReview rev, int Pid, string actionType)
        {
            if (actionType == "Add")
            {
                if (ModelState.IsValid)
                {
                    try{
                        _dbContext.TPReviews.Add(rev);
                        _dbContext.SaveChanges();
                    }
                    catch { return(View("Error")); }
                }
                else
                {
                    loadPersonViewBag(Pid);
                    return(View(rev));
                }
            }
            var model = _dbContext.TPersons
                        .SingleOrDefault(u => u.PerId.Equals(Pid));

            string dName = model.PerName1 + " " + model.PerName;

            ViewData["dName"] = dName;
            ViewData["PerId"] = Pid;

            CreateViewBags(Pid);
            ViewData["panel"] = 7;
            return(RedirectToAction("Edit", new { id = Pid, panel = 7, move = 0 }));
        }