public IActionResult CreateNewPlot([FromBody] PlotInputModel plot) { if (!ModelState.IsValid) { return(BadRequest()); } return(Ok(ResponseViewModel.Ok(_plotService.CreatePlot(plot)))); }
public ResponseViewModel CreatePlot(PlotInputModel plot) { var plotType = _plotService.GetAvailablePlotTypes().FirstOrDefault(x => x.Id == plot.PlotTypeId); if (plotType == null) { return(NotFound(ResponseMessageViewModel.INVALID_PLOT_TYPE, ResponseErrorCodeStatus.INVALID_PLOT_TYPE)); } var mappedResult = _mapper.Map <PlotInputModel, Plot>(plot); var savedResult = _mapper.Map <Plot, PlotViewModel>(_plotService.CreateNew(mappedResult)); return(Ok(savedResult)); }
public PlotKeywords Post(PlotInputModel obj) { PlotKeywords model = new PlotKeywords { KeywordName = obj.KeywordName }; var returned = _plotData.Add(model); _context.SaveChanges(); _context.MediaPlotKeywords.Add(new MediaPlotKeywords { KeywordID = returned.KeywordID, MediaID = obj.MediaID }); _context.SaveChanges(); return(model); }
public PlotViewModel EditPlot(PlotInputModel plot) { throw new NotImplementedException(); }