// PUT: api/OfferApi/5 public IHttpActionResult Put(Offer offer) { try { _offerAppService.Edit(offer); return(Ok()); } catch (Exception e) { return(InternalServerError(e)); } }
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)); } }