public async Task <ViewResult> Index() { var coupons = await _couponService.GetAll(); var couponViewModels = Mapper.Map <IEnumerable <CouponViewModel> >(coupons); return(View(couponViewModels)); }
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)); }
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)); }
public async Task <IEnumerable <Coupon> > GetAll() { return(await couponService.GetAll()); }