Exemplo n.º 1
0
        public async Task <IActionResult> GetPromoId(int id)
        {
            var result = await _promoService.GetByIdAsync(id);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }

            var promoResource = _mapper.Map <Promo, PromoResource>(result.Resource);

            return(Ok(promoResource));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> UnassignLocatblePromo(int locatableId, int promoId)
        {
            var existingPromo = await _promoService.GetByIdAsync(promoId);

            if (existingPromo == null)
            {
                return(BadRequest(ModelState.GetErrorMessages()));
            }
            var result = await _locatablePromoService.UnassignLocatablePromoAsync(locatableId, promoId);

            var resource = _mapper.Map <Promo, PromoResource>(result.Resource.Promo);

            return(Ok(resource));
        }