public IActionResult Index() { List <MineSweeperDTO> mineSweeperDTOs = new List <MineSweeperDTO>(); IEnumerable <MineSweeper.Lib.PTL.MineSweeper> mineSweeperInputList = _unitOfWork.GetUnitOfWork().MineSweeper.SP_GetAllMineInput(); foreach (var mineSweeper in mineSweeperInputList) { MineSweeperDTO mineSweeperDTO = _mapper.Map <MineSweeperDTO>(mineSweeper); mineSweeperDTO.Output = MineSweeperBL.ParseMineSweeperInput(mineSweeper.Input); mineSweeperDTOs.Add(mineSweeperDTO); } return(View(mineSweeperDTOs)); }
private ReturnFlag SaveSurvey(CollectSurveyViewModel collectSurveyViewModel) { ReturnFlag flag = ValidateReturn(collectSurveyViewModel); //UnitOfWork unitOfWork = new UnitOfWork(new BMWApplicationContext()); UnitOfWork unitOfWork = _UnitOfWorkServiceProvider.GetUnitOfWork(); Survey survey = new Survey(); survey.Age = collectSurveyViewModel.Age; if (flag == ReturnFlag.SUCCESSED) { survey.Gender = collectSurveyViewModel.Gender; survey.OwnLicence = collectSurveyViewModel.OwnLicence; survey.FirstCar = collectSurveyViewModel.FirstCar; survey.DriveTrain = collectSurveyViewModel.DriveTrain; survey.Drifting = collectSurveyViewModel.Drifting; survey.NumberOfBMWs = collectSurveyViewModel.NumberOfBMWs; } else if (flag == ReturnFlag.FIRST_CAR) { survey.Gender = collectSurveyViewModel.Gender; survey.OwnLicence = collectSurveyViewModel.OwnLicence; } else if (flag == ReturnFlag.PREFER_PUBLIC_TRANSPORT) { survey.Gender = collectSurveyViewModel.Gender; } else if (flag == ReturnFlag.UNDER_AGE) { } unitOfWork.Survies.Insert(survey); unitOfWork.Complete(); if (flag == ReturnFlag.SUCCESSED) { Model model; foreach (var m in collectSurveyViewModel.Models) { model = new Model(); model.SurveyId = survey.Id; model.ModelName = m.ModelName; unitOfWork.Models.Insert(model); } unitOfWork.Complete(); } return(flag); }
public IEnumerable <MineSweeper.Lib.PTL.MineSweeper> Get() { return(_unitOfWork.GetUnitOfWork().MineSweeper.SP_GetAllMineInput()); }