Example #1
0
        public async Task <ActionResult <ReportModelViewModel> > Add(ReportModelViewModel reportModel)
        {
            if (!ModelState.IsValid)
            {
                return(FormattedResponse(ModelState));
            }

            await _reportModelService.Add(_mapper.Map <ReportModel>(reportModel));

            return(FormattedResponse(reportModel));
        }
Example #2
0
        public async Task <ActionResult <ReportModelViewModel> > Update(Guid id, ReportModelViewModel reportModel)
        {
            if (id != reportModel.Id)
            {
                NotifyError("Id incorreto");
                return(FormattedResponse(reportModel));
            }

            if (!ModelState.IsValid)
            {
                return(FormattedResponse(ModelState));
            }

            await _reportModelService.Update(_mapper.Map <ReportModel>(reportModel));

            return(FormattedResponse(reportModel));
        }