Example #1
0
        public async Task <ViewResult> Index()
        {
            var coupons = await _couponService.GetAll();

            var couponViewModels = Mapper.Map <IEnumerable <CouponViewModel> >(coupons);

            return(View(couponViewModels));
        }
Example #2
0
        public IActionResult GetAll()
        {
            var entity = _manager.GetAll();

            if (entity.Count == 0)
            {
                return(NoResult());
            }
            return(ResponseJson(entity));
        }
 public IActionResult Get()
 {
     try
     {
         var result = _couponService.GetAll();
         return(Ok(result));
     }
     catch (Exception ex)
     {
         return(BadRequest("Something went wrong"));
     }
 }
        public ActionResult GetAll(DataTablesParam request)
        {
            var model = _couponService.GetAll().Select(a => new CouponViewModel()
            {
                Id        = a.Id,
                StrStatus = a.Status ? "Active" : "Inactive",
                Discount  = a.Discount,
                EndDate   = a.End_Date,
                StartDate = a.Start_Date
            });

            return(DataTablesResult.Create(model, request));
        }
Example #5
0
        public IActionResult Index()
        {
            var couponViewModelList = new List <CouponViewModel>();
            var coupons             = _couponService.GetAll();

            foreach (var item in coupons)
            {
                couponViewModelList.Add(new CouponViewModel {
                    Code           = item.Code.ToString(),
                    Password       = item.Password,
                    ValidityDate   = item.ValidityDate,
                    AvaliableCount = item.AvaliableCount,
                    TotalCount     = item.TotalCount
                });
            }

            return(View(couponViewModelList));
        }
Example #6
0
 public async Task <IEnumerable <Coupon> > GetAll()
 {
     return(await couponService.GetAll());
 }