예제 #1
0
 public void TearDown()
 {
     m_Presenter.Stop();
     m_View         = null;
     m_HistoryModel = null;
     m_Presenter    = null;
 }
예제 #2
0
 public void Setup()
 {
     m_View         = new TestHistoryView();
     m_HistoryModel = new TestHistoryModel();
     m_MainModel    = new TestMainModel();
     m_Presenter    = new HistoryPresenter(m_View, m_HistoryModel, m_MainModel);
 }
        public IHttpActionResult DeleteTestHistory([FromBody] TestHistoryModel testHistory)
        {
            TestHistoryDTO testHistoryDTO;

            try
            {
                testHistoryDTO = _testHistoryService.Delete(Mapper.Map <TestHistoryModel, TestHistoryDTO>(testHistory));
            }
            catch (Exception ex)
            {
                return(InternalServerError());
            }

            return(Ok(Mapper.Map <TestHistoryDTO, TestHistoryModel>(testHistoryDTO)));
        }
        public IHttpActionResult CreateTestHistory([FromBody] TestHistoryModel testHistory)
        {
            testHistory.UserId = User.Identity.GetUserId();

            TestHistoryDTO testHistoryDTO;

            try
            {
                testHistoryDTO = _testHistoryService.Insert(Mapper.Map <TestHistoryModel, TestHistoryDTO>(testHistory));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }

            return(Ok(Mapper.Map <TestHistoryDTO, TestHistoryModel>(testHistoryDTO)));
        }
        public IHttpActionResult UpdateTestHistory([FromBody] TestHistoryModel testHistory)
        {
            bool updateResult;

            try
            {
                updateResult = _testHistoryService.Update(Mapper.Map <TestHistoryModel, TestHistoryDTO>(testHistory));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }

            if (updateResult)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }