public ActionResult Delete(int id) { return(Execute(() => { var request = new DeleteHourLineRequest(id); RequestHandlerFactory .Get <DeleteHourLineRequest, ResponseBase>(request) .Handle(); })); }
public ActionResult <TimeSheet> Post([FromBody] TimeSheet timeSheet) { return(Execute(() => { var request = new StoreTimeSheetRequest(timeSheet); RequestHandlerFactory .Get <StoreTimeSheetRequest, ResponseBase>(request) .Handle(); return timeSheet; })); }
public ActionResult <TimeSheet> Get(int id) { // TODO: Dtos something something? return(Execute(() => { var request = new GetTimeSheetRequest(id); var response = RequestHandlerFactory .Get <GetTimeSheetRequest, GetTimeSheetReponse>(request) .Handle(); return response.TimeSheet.ValueOr(() => throw new EntityNotFoundException()); })); }
public void OnGet(int id) { PageTitle = "Edit Timesheet"; Execute(() => { var request = new GetTimeSheetRequest(id); var response = RequestHandlerFactory .Get <GetTimeSheetRequest, GetTimeSheetReponse>(request) .Handle(); TimeSheet = response .TimeSheet .ValueOr(() => throw new BusinessLogicException("Timesheet not found")); }); }
public ActionResult <TimeSheet[]> Get() { var currentUser = _currentUserService.Provide(); return(Execute(() => { var request = new TimeSheetOverviewRequest(currentUser.Id); var response = RequestHandlerFactory .Get <TimeSheetOverviewRequest, TimeSheetOverviewReponse>(request) .Handle(); return response.TimeSheets.ToArray(); })); }
public void Get_should_return_handler_with_get_method_set() { RequestHandler requestHandler = _requestHandlerFactory.Get("nowhere"); Assert.That(requestHandler.Method, Is.EqualTo("GET")); }