public IHttpActionResult AddSpecialOffer(AddSpecialOfferDto dto) { var offer = service.AddSpecialOffer(dto, User.Identity.GetUserId <int>()); string location = Request.RequestUri.ToString(); return(Created(location, Mapper.Map <SpecialOfferDto>(offer))); }
public SpecialOfferDto AddSpecialOffer(AddSpecialOfferDto dto, int userId) { var newOffer = ctx.SpecialOffers.Add(Mapper.Map <SpecialOffer>(dto)); newOffer.UserId = userId; UpdateExperience(userId, AddSpecialOfferExperience); badgesService.UpdateSpecialOfferBadges(userId); ctx.SaveChanges(); return(Mapper.Map <SpecialOfferDto>(newOffer)); }