public IActionResult Put(Guid id, [FromBody] HomeworkModel model) { try { var homework = homeworks.Update(id, HomeworkModel.ToEntity(model)); return(CreatedAtRoute("Get", new { id = homework.Id }, HomeworkModel.ToModel(homework))); } catch (ArgumentException e) { return(BadRequest(e.Message)); } }
public IActionResult Get(Guid id) { var homework = homeworks.Get(id); if (homework == null) { return(NotFound()); } return(Ok(HomeworkModel.ToModel(homework))); }
public IActionResult Get() { return(Ok(HomeworkModel.ToModel(homeworks.GetAll()))); }