Ejemplo n.º 1
0
        //GET: Admin/EditCard/5
        public IActionResult EditCard(int id)
        {
            try
            {
                if (IsAdmin())
                {
                    var search = _cardServices.GetCard(id);
                    if (search != null)
                    {
                        var categoryList = _categoryServices.GetCategories();
                        ViewBag.data = new SelectList(categoryList, "CategoryId", "CategoryName");
                        return(View(search));
                    }
                    Alert("Cannot get Card", NotificationType.error);
                    return(RedirectToAction("Index"));
                }
                Alert("You not permit to access that page", NotificationType.warning);
                return(RedirectToAction("Login", "Home"));
            }
            catch (Exception e)
            {
                Alert(e.Message, NotificationType.error);
                return(RedirectToAction("Index"));

                throw;
            }
        }
Ejemplo n.º 2
0
        // GET: Card
        public ActionResult CardAction()
        {
            DataTable dtblCard = new DataTable();
            int       id       = 1;

            dtblCard = CardService.GetCard(id);
            return(PartialView("_CardView", dtblCard));
        }
Ejemplo n.º 3
0
 //GET: User/CreateTrans
 public IActionResult CreateTransaction(int id)
 {
     if (IsLoggedIn())
     {
         var username   = HttpContext.Session.GetString("username");
         var searchCard = _cardServices.GetCard(id);
         if (searchCard != null)
         {
             var model = new Transaction
             {
                 CardId     = searchCard.CardId,
                 Username   = username,
                 TransImage = searchCard.ImageName,
             };
             return(View(model));
         }
         return(RedirectToAction("Index"));
     }
     Alert("You need Log in to access this page", NotificationType.warning);
     return(RedirectToAction("Login", "Home"));
 }