Exemple #1
0
 // PUT: api/OfferApi/5
 public IHttpActionResult Put(Offer offer)
 {
     try
     {
         _offerAppService.Edit(offer);
         return(Ok());
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
Exemple #2
0
        public ActionResult Edit(OfferCreateViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    model.LoadCollections(db.Colors);
                    return(View(model));
                }

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

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