コード例 #1
0
 public ShowBoardViewModel(int id, string name, List <ListViewModel> lists, CreateListDto createListDto)
 {
     Id            = id;
     Name          = name;
     Lists         = lists;
     CreateListDto = createListDto;
 }
コード例 #2
0
ファイル: ListsController.cs プロジェクト: KarolN/Board
        public async Task <ActionResult> Create(CreateListDto createListDto)
        {
            var boardId = await _listsService.CreateNewList(createListDto);

            if (boardId == null)
            {
                return(HttpNotFound());
            }
            return(RedirectToAction("Show", "Boards", new { selectedBoard = boardId }));
        }
コード例 #3
0
        public void AddList(CreateListDto dto)
        {
            var list = new List
            {
                Name    = dto.Name,
                BoardId = dto.BoardId
            };

            using (var db = new PGSBoardContext())
            {
                db.Lists.Add(list);
                db.SaveChanges();
            }
        }
コード例 #4
0
ファイル: ListsService.cs プロジェクト: KarolN/Board
        public async Task <long?> CreateNewList(CreateListDto createListDto)
        {
            var count = await _listsRepository.GetCountListsInBoard(createListDto.BoardId);

            var list = new List()
            {
                Name     = createListDto.Name,
                BoardId  = createListDto.BoardId,
                Position = count
            };

            _listsRepository.Insert(list);
            await _listsRepository.SaveChangesOnContext();

            return(createListDto.BoardId);
        }
コード例 #5
0
        public IActionResult CreateList([FromBody] CreateListDto createListDto)
        {
            var list = _mapper.Map <List>(createListDto);

            try
            {
                var createdList = _listService.Create(list);

                var res = new ObjectResult(new { listId = createdList.Id });
                res.StatusCode = StatusCodes.Status201Created;

                return(res);
            }
            catch (Exception ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }
コード例 #6
0
 //Method for creating new list
 public void CreateList(CreateListDto dto)
 {
     this.boardsRepository.AddList(dto);
 }
コード例 #7
0
 public ActionResult CreateList(CreateListDto dto)
 {
     _boardsService.CreateList(dto);
     return(RedirectToAction("Show", new { SelectedBoardId = dto.BoardId }));
 }
コード例 #8
0
ファイル: ShowBoardViewModel.cs プロジェクト: KarolN/Board
 public ShowBoardViewModel()
 {
     CreateListDto = new CreateListDto();
     Lists         = new List <ListViewModel>();
 }
コード例 #9
0
        public Task <RequestResult <ListModel> > CreateListAsync(CreateListDto dto)
        {
            string requestId = RequestIdProvider.GetRequestId();

            return(_webApiClient.ExecuteRequestAsync(webApi => webApi.CreateList(requestId, dto)));
        }