Exemple #1
0
        public IActionResult Create([FromBody] CreateSectionDto dto)
        {
            var response = new APIResponseViewModel();

            response.Status  = true;
            response.Message = "Data Retrive Sucess";
            return(Ok(response));
        }
Exemple #2
0
        public void CreateSection(CreateSectionDto createSectionDto)
        {
            var newSection = Mapper.Map <Section>(createSectionDto);

            newSection.UserId = _accRepo.GetProfileIdByAccountId(createSectionDto.UserAccountId);
            _sectionRepo.AddNewItem(newSection);
            _sectionRepo.SaveChanges();
        }
Exemple #3
0
        public void Create(CreateSectionDto dto)
        {
            var section = new SectionDbEntity();

            section.Titel       = dto.Titel;
            section.Discerption = dto.Discerption;
            section.Image       = dto.Image;

            _DB.sections.Add(section);
            _DB.SaveChanges();
        }
        public async Task <ActionResult> Create(CreateSectionViewModel sectionViewModel)
        {
            var existingCode = await _sectionService.FindByCode(sectionViewModel.Code);

            if (existingCode == null)
            {
                var section = new CreateSectionDto
                {
                    Code      = sectionViewModel.Code,
                    Class     = sectionViewModel.Class,
                    Period    = sectionViewModel.Period,
                    Professor = sectionViewModel.Professor,
                    Students  = sectionViewModel.Students
                };
                await _sectionService.Create(section);

                return(Ok());
            }
            else
            {
                return(BadRequest("Ya existe una seccion con este codigo"));
            }
        }