public bool BlockSection(SectionDetailsViewModel blockModel) { var section = _sectionService.GetSectionEntity(blockModel.Id); if (section == null) { return false; } section.IsBlocked = blockModel.IsBlocked; _sectionService.UpdateSection(section); return true; }
public static SectionDetailsViewModel ToSectionDetailsModel(this SectionEntity entity) { var viewModel = new SectionDetailsViewModel() { CreationDate = entity.CreationDate, IsBlocked = entity.IsBlocked, Id = entity.Id, SectionName = entity.SectionName, UserRefId = entity.UserRefId, SettedModeratorLogin = entity.ModeratorLogin, }; foreach (var category in entity.Categories) { viewModel.Categories.Add(category.CategoryName); } return viewModel; }