//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); }
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 })); } }
public bool Handle(NewSectionRequest request, IOutputPort <int> outputPort) { int newSectionId = _sectionRepository.Create(new SectionDto() { Name = request.Name }); outputPort.Handle(newSectionId); return(true); }
public void AddSection(Section section) { _sectionRepository.Create(section); _sectionRepository.Save(); }
public void CreateSection(SectionEntity section) { sectionRepository.Create(section.ToDalSection()); uow.Commit(); }