Example #1
0
        public async Task <string> Create(GroupBoard item)
        {
            var result = _mapper.Map <GroupBoardDB>(item);

            result.GroupProducts = null;
            result.GroupComments = null;

            var modelUser = (await _dataBase.Find <GroupUserDB>(
                                 x => x.RightToCreateBoards == true &&
                                 x.UserId == result.CreatorId &&
                                 x.GroupId == result.GroupId).ConfigureAwait(false)).FirstOrDefault();

            if (modelUser == null)
            {
                throw new ValidationException("User not found");
            }

            result.Id           = Guid.NewGuid().ToString();
            result.IsNotDeleted = true;
            result.Created      = DateTime.UtcNow;
            result.Deleted      = null;
            result.Modified     = DateTime.UtcNow;

            _dataBase.Create(result);
            await _dataBase.Save();

            return(result.Id);
        }
        public async Task <IHttpActionResult> Create([FromUri] string groupId, GroupBoard item)
        {
            item.GroupId = groupId;

            item.Id = await _groupBoardService.Create(item);

            return(Ok(item));
        }
 /// <summary>
 /// リーダー設定
 /// </summary>
 private void setLeader()
 {
     for (int i = 0; i < groupNum; i++)
     {
         GroupBoard board = boardList[i];
         board.SetMember(beyond.leaderList[i]);
         // Debug.Log(string.Format("leader[{0}]:{1}", i, beyond.leaderList[i]));
     }
 }
 /// <summary>
 /// ボード初期化
 /// </summary>
 private void initBoard()
 {
     for (int i = 0; i < groupNum; i++)
     {
         GameObject obj   = Instantiate(prefabBoard, parentBoard);
         GroupBoard board = obj.GetComponent <GroupBoard>();
         board.GroupNo = i;
         boardList.Add(board);
     }
 }
Example #5
0
 private void Awake()
 {
     if (instace != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instace = this;
     }
 }
Example #6
0
        public void TestCaseSetup()
        {
            _groupBoard = new GroupBoard
            {
                Id            = "00000000-0000-0000-0000-000000000000",
                CreatorId     = "2",
                Information   = "Some product",
                Name          = "Best",
                GroupId       = "00000000-0000-0000-0000-000000000001",
                GroupProducts = null
            };
            _groupBoardDB = new GroupBoardDB
            {
                Id            = "00000000-0000-0000-0000-000000000000",
                CreatorId     = "2",
                Information   = "Some product",
                Name          = "Best",
                Created       = DateTime.UtcNow,
                Deleted       = null,
                IsNotDeleted  = true,
                Modified      = DateTime.UtcNow,
                GroupId       = "00000000-0000-0000-0000-000000000001",
                GroupProducts = null
            };
            _groupBoardDB.GroupProducts = new List <GroupProductDB>
            {
                new GroupProductDB
                {
                    Information = "Information"
                }
            };
            _groupUserDB = new GroupUserDB
            {
                GroupId             = "00000000-0000-0000-0000-000000000001",
                RightToCreateBoards = true
            };
            _groupRepositoryMock = new Mock <IGroupRepository>();

            var config = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(new GroupProfile());
                cfg.AddProfile(new GroupBoardProfile());
                cfg.AddProfile(new GroupProductProfile());
                cfg.AddProfile(new GroupUserProfile());
                cfg.AddProfile(new GroupCommentProfile());
            });

            _mapper            = (new Mapper(config)).DefaultContext.Mapper;
            _groupBoardService = new GroupBoardService(_groupRepositoryMock.Object, _mapper);
            _selectedBoardList = new List <GroupBoardDB>();
            _selectedUserList  = new List <GroupUserDB>();
        }
Example #7
0
 protected void dodo_ServerClick(object sender, EventArgs e)
 {
     if (!IsOnline)
     {
         SignOn();
         return;
     }
     var c = new GroupBoard();
     c.Content = cContent.Value;
     c.Id = HomoryContext.Value.GetId();
     c.GroupId = CurrentGroup.Id;
     c.State = State.启用;
     c.Time = DateTime.Now;
     c.UserId = CurrentUser.Id;
     HomoryContext.Value.GroupBoard.Add(c);
     HomoryContext.Value.SaveChanges();
     cContent.Value = "";
     cPanel.RaisePostBackEvent("Refresh");
 }
Example #8
0
        public async Task Update(GroupBoard item)
        {
            var result = _mapper.Map <GroupBoardDB>(item);

            var model = (await _dataBase.Find <GroupBoardDB>(
                             x => x.Id == result.Id).ConfigureAwait(false)).FirstOrDefault();

            if (model == null)
            {
                throw new ValidationException("Board not found");
            }

            model.Information = result.Information;
            model.Name        = result.Name;
            model.Modified    = DateTime.UtcNow;

            _dataBase.Update(model);
            await _dataBase.Save();
        }
        public async Task <IHttpActionResult> Update(GroupBoard item)
        {
            await _groupBoardService.Update(item);

            return(Ok(item));
        }