示例#1
0
        public async Task <int> SaveRover(Rover.Domain.Rover rover)
        {
            var persistenceRover = Mapper.Map <PersistenceRover>(rover);

            _context.Rovers.Add(persistenceRover);
            return(await _context.SaveChangesAsync());
        }
示例#2
0
        public async Task <int> UpdateRover(Rover.Domain.Rover rover)
        {
            var persistenceRover = _context.Rovers.First(t => t.Id == rover.Id);

            persistenceRover.Point = new Point(rover.Point.XPosition, rover.Point.YPosition);
            return(await _context.SaveChangesAsync());
        }
示例#3
0
        public async Task <int> UpdateRover(Rover.Domain.Rover rover)
        {
            var persistenceRover = _context.Rovers.Include(t => t.Plateau).First(t => t.Id == rover.Id);

            persistenceRover.Point     = rover.Point;
            persistenceRover.Direction = rover.Direction;
            persistenceRover.PlateauId = rover.PlateauId;
            persistenceRover.IsLocked  = rover.IsLocked;
            return(await _context.SaveChangesAsync());
        }