Esempio n. 1
0
        public void Update(UpdateSectionDto updateSectionDto)
        {
            Section sectionForUpdate = DbSet.Find(updateSectionDto.SectionId);

            sectionForUpdate.Title      = updateSectionDto.Title;
            sectionForUpdate.DateUpdate = DateTime.Now;
        }
        public async Task <ActionResult> Edit(int id, CreateSectionViewModel sectionViewModel)
        {
            var temp = await _sectionService.FindById(id);

            var existingCode = await _sectionService.FindByCode(sectionViewModel.Code);

            if (existingCode == null || existingCode.Code == temp.Code)
            {
                var section = new UpdateSectionDto()
                {
                    Code      = sectionViewModel.Code,
                    Class     = sectionViewModel.Class,
                    Period    = sectionViewModel.Period,
                    Professor = sectionViewModel.Professor,
                    Students  = sectionViewModel.Students
                };
                await _sectionService.Update(id, section);

                return(Ok());
            }
            else
            {
                return(BadRequest("Ya existe una seccion con este codigo"));
            }
        }
Esempio n. 3
0
        public IActionResult Update([FromBody] UpdateSectionDto dto)
        {
            var response = new APIResponseViewModel();

            response.Status  = true;
            response.Message = "Data Updated Sucess";
            return(Ok(response));
        }
Esempio n. 4
0
        public void Update(UpdateSectionDto dto)
        {
            var section = _DB.sections.SingleOrDefault(x => x.Id == dto.Id && !x.IsDelete);

            section.Titel       = dto.Titel;
            section.Discerption = dto.Discerption;
            section.Image       = dto.Image;
            _DB.sections.Update(section);
            _DB.SaveChanges();
        }
Esempio n. 5
0
 public void UpdateSection(UpdateSectionDto updateSectionDto)
 {
     _sectionRepo.Update(updateSectionDto);
     _sectionRepo.SaveChanges();
 }