public void Create(DalSection entity) { var section = entity.ToSection(); section.SectionId = 0; _dbContext.Set <Section>().Add(section); }
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 static BllSection ToBllSection(this DalSection dalSection) { return(new BllSection() { Id = dalSection.Id, Name = dalSection.Name, Topics = dalSection.Topics.Select(t => t.ToBllTopic()), }); }
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 Visit(DalSection dalSection) { CheckArgumentNull(dalSection); OrmEntity = new Section() { Id = dalSection.Id, Name = dalSection.Name }; }
public void Create(DalSection entity) { var section = new Section() { Id = entity.Id, Name = entity.Name, DateAdded = entity.DateAdded }; context.Set<Section>().Add(section); }
/// <summary> /// Adding section /// </summary> /// <param name="entity">section for adding</param> public void Create(DalSection entity) { var section = new Section() { Id = entity.Id, Name = entity.Name }; context.Set <Section>().Add(section); context.SaveChanges(); }
public static SectionEntity ToBllSection(this DalSection dalSection) { if (dalSection != null) { return(new SectionEntity() { Id = dalSection.Id, Name = dalSection.Name }); } return(null); }
public static SectionEntity ToBllSection(this DalSection dalSection) { return(new SectionEntity() { Id = dalSection.Id, SectionName = dalSection.Name, PostsInSection = dalSection.PostsInSection.Select(p => new PostEntity() { Id = p.Id, Name = p.Name, AuthorLogin = p.AuthorLogin, DateOfPost = p.DateOfPost, SectionId = p.SectionId, AuthorId = p.AuthorId }) }); }
public void CreateNewSection(DalSection e) { NullRefCheck(); ArgumentNullCheck(e); var section = new Section() { Id = e.Id, Name = e.Name, }; context.Set <Section>().Add(section); }
public void Delete(DalSection e) { NullRefCheck(); ArgumentNullCheck(e); var section = new Section() { Id = e.Id, Name = e.Name, }; section = context.Set <Section>().Single(u => u.Id == section.Id); context.Set <Section>().Remove(section); }
public static Section ToSection(this DalSection dalSection) { return(new Section() { CreationDate = dalSection.CreationDate, SectionId = dalSection.Id, IsBlocked = dalSection.IsBlocked, SectionName = dalSection.SectionName, UserRefId = dalSection.UserRefId, Discription = dalSection.Discription, Categories = dalSection.Categories.ToCategoryCollection() }); }
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 static SectionEntity ToBllSection(this DalSection dalSection) { return(new SectionEntity() { CreationDate = dalSection.CreationDate, Id = dalSection.Id, IsBlocked = dalSection.IsBlocked, SectionName = dalSection.SectionName, UserRefId = dalSection.UserRefId, ModeratorLogin = dalSection.ModeratorLogin, Discription = dalSection.Discription, CategoriesCount = dalSection.CategoriesCount, Categories = dalSection.Categories.ToCategoryEntityCollection() }); }
public void DeleteSection(int id) { DalSection section = sectionRepository.First(s => s.Id == id); foreach (var t in section.Topics.ToList()) { t.Section.Id = 1; topicRepository.Update(t); } try { sectionRepository.Delete(id); } catch (InvalidOperationException e) { logger.Warn(e.Message); throw; } }
public void Update(DalSection entity) { NullRefCheck(); throw new NotImplementedException(); }