Esempio n. 1
0
 // POST: api/OfferApi
 public IHttpActionResult Post(Offer offer)
 {
     try
     {
         _offerAppService.Add(offer);
         return(Ok());
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
Esempio n. 2
0
        public ActionResult Create(OfferCreateViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    model.LoadCollections(db.Colors);
                    return(View(model));
                }

                var offer = Mapper.Map <OfferCreateViewModel, Offer>(model);
                _offerAppService.Add(offer);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                model.LoadCollections(db.Colors);
                return(View(model));
            }
        }