public ActionResult GetProgramById(int id) { _logger.LogInformation("Getting a programs"); var program = _programService.GetById(id); var programModels = ProgramMapper.SerializeProgram(program); return(Ok(programModels)); }
public ActionResult AddProgram([FromBody] ProgramModel program) { _logger.LogInformation("Adding a new Program"); program.LastUpdate = DateTime.UtcNow; var programData = ProgramMapper.SerializeProgram(program); var newProgram = _programService.CreateProgram(programData); return(Ok(newProgram)); }
public ActionResult UpdateProgram([FromBody] ProgramModel program) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } program.LastUpdate = DateTime.UtcNow; var programData = ProgramMapper.SerializeProgram(program); var newProgram = _programService.UpdateProgram(programData); return(Ok(newProgram)); }