public async Task put(int id, ClasroomRequest request) { var model = await _repository.GetByIdAsync(id); model.Name = request.Name; await _repository.Put(model); }
public async Task <Classroom> postAsync(ClasroomRequest request) { Classroom model = new Classroom(); model.Name = request.Name; model.Teacher = await _teacher.GetByEmail(request.Teacher); var newModel = await _repository.PostAsync(model); return(_repository.Find(x => x.Id == newModel.Id, x => x.assignments, x => x.Posts, x => x.Students, x => x.Teacher)); }
public async Task <ActionResult> put(int id, [FromBody] ClasroomRequest request) { try { await _manager.put(id, request); return(NoContent()); }catch (Exception ex) { ex.Message.ToString(); return(BadRequest()); } }
public async Task <ActionResult <Classroom> > post([FromBody] ClasroomRequest request) { try { var model = await _manager.postAsync(request); return(Ok(model)); }catch (Exception ex) { ex.Message.ToString(); return(BadRequest()); } }