Esempio n. 1
0
        //Crée un tableau non verrouillé avec ses trois sections (Todo, Doing, Done)
        public async Task <BoardDTO> CreateBoard(BoardDTO board)
        {
            board.IsLocked = false;
            var boardDb = await boardRepository.Create(board);

            await sectionRepository.Create(new SectionDTO()
            {
                Name    = "Todo",
                BoardId = boardDb.Id
            });

            await sectionRepository.Create(new SectionDTO()
            {
                Name    = "Doing",
                BoardId = boardDb.Id
            });

            await sectionRepository.Create(new SectionDTO()
            {
                Name    = "Done",
                BoardId = boardDb.Id
            });

            return(boardDb);
        }
Esempio n. 2
0
        public IActionResult CreateSection([FromBody] Section section)
        {
            var lang          = Request.Headers["language"].ToString();
            var errorMessages = new List <string>();

            var course = _courseRepository.FindById(section.Course.Id);

            try
            {
                var newSection = new Section()
                {
                    Course    = course,
                    Name_EN   = section.Name_EN,
                    Name_FR   = section.Name_FR ?? section.Name_EN,
                    Slug_EN   = new SlugHelper().GenerateSlug(section.Name_EN),
                    Slug_FR   = section.Name_FR != null ? new SlugHelper().GenerateSlug(section.Name_FR) : new SlugHelper().GenerateSlug(section.Name_EN),
                    Order     = section.Order,
                    CreatedAt = DateTime.Now,
                    UpdatedAt = DateTime.Now,
                    CreatedBy = section.CreatedBy,
                    UpdatedBy = section.UpdatedBy,
                    DeletedAt = null,
                    DeletedBy = null
                };

                var createdSection = _sectionRepository.Create(newSection);

                return(Ok(new { createdSection }));
            }
            catch
            {
                errorMessages.Add(_translator.GetTranslation("ERROR", lang));
                return(BadRequest(new { errors = errorMessages }));
            }
        }
Esempio n. 3
0
        public bool Handle(NewSectionRequest request, IOutputPort <int> outputPort)
        {
            int newSectionId = _sectionRepository.Create(new SectionDto()
            {
                Name = request.Name
            });

            outputPort.Handle(newSectionId);

            return(true);
        }
Esempio n. 4
0
        public void AddSection(Section section)
        {
            _sectionRepository.Create(section);

            _sectionRepository.Save();
        }
Esempio n. 5
0
 public void CreateSection(SectionEntity section)
 {
     sectionRepository.Create(section.ToDalSection());
     uow.Commit();
 }