Exemplo n.º 1
0
        public async Task <ActionResult> Delete(int id)
        {
            PromoViewModel promo = await PromoService.GetPromo(id);

            if (promo == null)
            {
                return(Json(new GenericResult()
                {
                    Result = false,
                    Message = "Invalid promo code"
                }));
            }

            if (!promo.CanDelete)
            {
                return(Json(new GenericResult()
                {
                    Result = false,
                    Message = "Promo not eligible for deletion"
                }));
            }

            return(Json(await PromoService.Delete(id)));
        }