Beispiel #1
0
        public async Task Update(Guid id, UpsertOfferModel model)
        {
            var offer = await _repository.GetById(id);

            offer.Update(model.Name, model.Description, model.Price, model.CategoryId);

            _repository.Update(offer);
            await _repository.SaveChanges();
        }
Beispiel #2
0
        public async Task <OfferModel> Add(UpsertOfferModel model)
        {
            var offer = _mapper.Map <Offer>(model);

            await _repository.Add(offer);

            await _repository.SaveChanges();

            return(_mapper.Map <OfferModel>(offer));
        }
        public async Task <IActionResult> Update([FromRoute] Guid id, [FromBody] UpsertOfferModel model)
        {
            await _offersService.Update(id, model);

            return(NoContent());
        }
        public async Task <IActionResult> Add([FromBody] UpsertOfferModel model)
        {
            var result = await _offersService.Add(model);

            return(Created(result.Id.ToString(), null));
        }