예제 #1
0
 public ShowBoardViewModel(int id, string name, List <ListViewModel> lists, CreateListDto createListDto)
 {
     Id            = id;
     Name          = name;
     Lists         = lists;
     CreateListDto = createListDto;
 }
예제 #2
0
        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
        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 }));
            }
        }
 //Method for creating new list
 public void CreateList(CreateListDto dto)
 {
     this.boardsRepository.AddList(dto);
 }
 public ActionResult CreateList(CreateListDto dto)
 {
     _boardsService.CreateList(dto);
     return(RedirectToAction("Show", new { SelectedBoardId = dto.BoardId }));
 }
예제 #8
0
 public ShowBoardViewModel()
 {
     CreateListDto = new CreateListDto();
     Lists         = new List <ListViewModel>();
 }
        public Task <RequestResult <ListModel> > CreateListAsync(CreateListDto dto)
        {
            string requestId = RequestIdProvider.GetRequestId();

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