public async Task <JsonResult> Update(int id, ProfessorRequestViewModel viewRequest) { ProfessorRequestModel request = Mapper.Map <ProfessorRequestModel>(viewRequest); ProfessorResponseModel response = await studentSystemApi.Execute(professorsClient.UpdateAsync, id, request); ProfessorResponseViewModel viewResponse = Mapper.Map <ProfessorResponseViewModel>(response); return(Json(viewResponse)); }
public ProfessorResponseModel Get(int id) { ProfessorByIdQuery query = new ProfessorByIdQuery(id); Professor professor = professorByIdHandler.Handle(query); ProfessorResponseModel response = professorsMapper.Map(professor); return(response); }
public ProfessorResponseModel Update(int id, ProfessorRequestModel request) { UpdateProfessorCommand command = new UpdateProfessorCommand(id, request.FirstName, request.LastName); Professor professor = updateProfessorHandler.Handle(command); ProfessorResponseModel response = professorsMapper.Map(professor); return(response); }
public ProfessorResponseModel Create(ProfessorRequestModel request) { ProfessorCommand command = new ProfessorCommand(request.FirstName, request.LastName); Professor professor = createProfessorHandler.Handle(command); ProfessorResponseModel response = professorsMapper.Map(professor); return(response); }
public async Task <JsonResult> Get(int id) { ProfessorResponseModel response = await studentSystemApi.Execute(professorsClient.GetAsync, id); if (response == null) { return(Json(new ProfessorResponseViewModel(), JsonRequestBehavior.AllowGet)); } ProfessorResponseViewModel viewResponse = Mapper.Map <ProfessorResponseViewModel>(response); return(Json(viewResponse, JsonRequestBehavior.AllowGet)); }