Ejemplo n.º 1
0
        public ActionResult <StatisticsViewModel> Post([FromBody] EditShareViewModel model)
        {
            var statisticsDto = new StatisticsDTO();

            service.AddShare(Mapper.Map <ShareDTO>(model), statisticsDto);

            Response.StatusCode = 201;
            return(Mapper.Map <StatisticsViewModel>(statisticsDto));
        }
Ejemplo n.º 2
0
        public ActionResult <StatisticsViewModel> Put(int id, [FromBody] EditShareViewModel model)
        {
            var dto   = new StatisticsDTO();
            var share = service.GetShareById(id, dto);

            if (share == null)
            {
                return(NotFound(Mapper.Map <StatisticsViewModel>(dto)));
            }

            share = Mapper.Map <ShareDTO>(model);
            service.EditShare(id, share, dto);

            return(Mapper.Map <StatisticsViewModel>(dto));
        }