public void Save(IBulletinRepository rep) { try { if (!IsNew & IsDeleted) { /* [Delete] an existing object marked for deletion */ //dc.BulletinDelete(_id); } else { /* Exception will cause the transaction to rollback */ if (IsNew) { /* [Insert] a new and valid object to be saved */ this.Id = rep.Insert(BuildInteface(false)); rep.InsertContent(BuildInteface(true)); } else if (!IsNew & IsDirty) { /* [Update] a existing, but changed object to be saved */ rep.Update(BuildInteface(true)); } } MarkOld(); } catch (Exception ex) { throw ex; } }
public static BulletinBase LoadForGallery(int galleryId, IBulletinRepository bRep) { var bulletin = bRep.FetchOnGalleryId(galleryId); var obj = ((BulletinBase)Reflector.CreateObject(bulletin.BulletinType.Assembly, bulletin.BulletinType.Class, new[] { bulletin })).Desrialize(bulletin.Content.ToString()); obj.BulletinType = new BulletinType(bRep.FetchType(bulletin.BulletinType.BulletinTypeId)); obj.MarkOld(); return(obj); }
public static CollectionBase <BulletinBase> GetAll(ILookupRepository lRep, IBulletinRepository bRep) { var bulletins = new CollectionBase <BulletinBase>(); bulletins.AddRange(bRep.FetchList().Select(bulletin => ((BulletinBase)Reflector.CreateObject(bulletin.BulletinType.Assembly, bulletin.BulletinType.Class, new[] { bulletin })). Desrialize(bulletin.Content.ToString()))); bulletins.ForEach(b => { b.MarkOld(); b.LoadCategoryInfo(lRep); }); return(bulletins); }
public BulletinController(ILookupRepository lookupRepository, IBulletinRepository bulletinRepository) { _lookupRepository = lookupRepository; _bulletinRepository = bulletinRepository; }
public BulletinService(IDistributedCache cache, IBulletinRepository repository) { _cache = cache; _repository = repository; }
public BulletinManager(IBulletinRepository bulletinRepository, UserManager <ApplicationUser> userManager) { _bulletinRepository = bulletinRepository; _userManager = userManager; }