示例#1
0
 // GET: Offer
 public ActionResult Index()
 {
     try
     {
         var offers = _offerAppService.GetOffers();
         var model  = Mapper.Map <IEnumerable <Offer>, IEnumerable <OfferViewModel> >(offers);
         return(View(model));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
示例#2
0
        // GET: api/OfferApi
        public IHttpActionResult Get()
        {
            try
            {
                var offers = _offerAppService.GetOffers().ToList();

                if (!offers.Any())
                {
                    return(NotFound());
                }

                return(Ok(offers));
            }
            catch (Exception e)
            {
                return(InternalServerError(e));
            }
        }