public void Delete(DalSection entity) { var section = entity.ToSection(); section.Categories = _categoryRepository.GetCategoriesBySectionId(entity.Id).ToCategoryCollection(); section = _dbContext.Set<Section>().Single(s => s.SectionId == section.SectionId); _dbContext.Set<Section>().Remove(section); }
public void Delete(DalSection entity) { var section = context.Set<Section>().Where(s => s.Id == entity.Id).FirstOrDefault(); if (section != null) { context.Set<Section>().Remove(section); } }
public void Update(DalSection entity) { var section = context.Set<Section>().Where(s => s.Id == entity.Id).FirstOrDefault(); if (section != null) { section.Name = entity.Name; section.DateAdded = entity.DateAdded; } }
public void Create(DalSection entity) { var section = new Section() { Id = entity.Id, Name = entity.Name, DateAdded = entity.DateAdded }; context.Set<Section>().Add(section); }
public void CreateSection() { var section = new DalSection() { CreationDate = DateTime.Now, IsBlocked = false, SectionName = "Stars", UserRefId = 1 }; SectionRepository.Create(section); Context.SaveChanges(); }
public void Update(DalSection entity) { var existedSection = _dbContext.Entry<Section>(_dbContext.Set<Section>().Find(entity.Id)); if (existedSection == null) { return; } existedSection.State = EntityState.Modified; existedSection.Entity.IsBlocked = entity.IsBlocked; existedSection.Entity.UserRefId = entity.UserRefId; existedSection.Entity.Discription = entity.Discription; existedSection.Entity.SectionName = entity.SectionName; }
public void Create(DalSection entity) { var section = entity.ToSection(); section.SectionId = 0; _dbContext.Set<Section>().Add(section); }