public IHttpActionResult Post(Offer offer) { offerRepository.Insert(offer); string uri = Url.Link("GetOfferById", new { id = offer.OfferId }); return(Created(uri, offer)); }
public Offer Insert(Offer Offer) { OfferRepository <Offer> Offerrepo = new OfferRepository <Offer>(); SCategory scate = new SCategory(); var cate = scate.FindCategoryById(Offer.CategoryId); Offer.DateOffer = DateTime.Now; int?rta = Offerrepo.Insert(Offer); if (rta == null) { return(null); } else { Offer.Id = (int)rta; Log4NetLogger logger2 = new Log4NetLogger(); SUser suser = new SUser(); var user = suser.GetUserById(new Guid(Offer.IdUser)); logger2.Info("Creación Oferta:" + Offer.TitleOffer + "," + "Por:" + user.UserName + ",Categoria:" + cate.Name); return(Offer); } }