コード例 #1
0
ファイル: HostControllers.cs プロジェクト: JTLaMarre/JavaBox
        public IActionResult pickGame(string RoomCode, string Game)
        {
            var host = _repo.GetHost(RoomCode);

            host.game.GameName = Game;
            _repo.Update();
            return(Ok());
        }
コード例 #2
0
ファイル: HostService.cs プロジェクト: figwh/HostManager
 public void UpdateHost(int id, Host newHost)
 {
     //update host
     m_HostRepo.Update(id, newHost);
     //delete old hosttag
     m_HostTagRepo.DeleteByHostId(id);
     //insert new
     SaveHostTag(newHost, id);
 }
コード例 #3
0
ファイル: LoadBalService.svc.cs プロジェクト: LexaGal/Meat
        public State SaveTask(Task task)
        {
            HostRepository hostRepo = new HostRepository();
            TaskRepository taskRepo = new TaskRepository();

            var host = hostRepo.Get(task.HostId);

            if (host == null)
            {
                return new State {
                           IsError = true, Message = "There is no any host with this id!"
                }
            }
            ;
            if (host.IsBusy)
            {
                return new State {
                           IsError = true, Message = "This host is already busy!"
                }
            }
            ;

            taskRepo.Create(new TaskEntity
            {
                HostId = task.HostId,
                TaskId = task.TaskId,
                //Array = task.Data.Array,
                Height     = task.Data.Height,
                Width      = task.Data.Width,
                StepsCount = task.StepsCount
            });
            taskRepo.Save();

            host.IsBusy = !(host.IsBusy);
            hostRepo.Update(host);
            hostRepo.Save();

            return(new State {
                IsError = false, Message = "Task was saved succesfully!"
            });
        }
    }
}
コード例 #4
0
ファイル: HostService.cs プロジェクト: RAVER0306/-
 /// <summary>
 /// 修改主机基本信
 /// </summary>
 /// <param name="cachePageId">当前用户获取的主机列表缓存页主键</param>
 /// <param name="dtos">输入信息实体模型</param>
 /// <returns></returns>
 public OperationResult EditHosts(Guid[] cachePageId, params HostInputDto[] dtos) => HostRepository.Update(dtos,
                                                                                                           checkAction: (dto, entity) =>
 {
     if (!(cachePageId.Contains(dto.Id)))
     {
         throw new Exception($"id:主机{dto.FullName}&{dto.RegPackage}不存在或你未获取过该数据!");
     }
 },
                                                                                                           updateFunc: (dto, entity) =>
 {
     //var value = dto.MapTo<Host>();
     //value.CreatedTime = entity.CreatedTime;
     return(entity);
 });