public IActionResult pickGame(string RoomCode, string Game) { var host = _repo.GetHost(RoomCode); host.game.GameName = Game; _repo.Update(); return(Ok()); }
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); }
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!" }); } } }
/// <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); });