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)); }
public ActionResult <MineSweeper.Lib.PTL.MineSweeper> Put([FromBody] MineSweeperDTO entityDTO) { MineSweeper.Lib.PTL.MineSweeper entity = _mapper.Map <MineSweeper.Lib.PTL.MineSweeper>(entityDTO); //Add Required Info to Model entity.ModifiedDate = DateTime.Now; //get client IP address entity.IPAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString(); _unitOfWork.GetUnitOfWork().MineSweeper.Update(entity); //commit changes if (_unitOfWork.GetUnitOfWork().Complete() == 1) { return(Result(StatusCodes.Status200OK, "MineSweeper input record updated.")); } else { return(Result(StatusCodes.Status400BadRequest, "MineSweeper input record can not be updated, Please check log.")); } }