private Bulletin ToEntity(BulletinCache cache, Bulletin entity) { entity.Title = cache.Title; entity.Description = cache.Description; entity.Images = cache.Images; entity.Price = cache.Price; entity.DatePublication = cache.PublicationDate; var group = BCT.Context.BulletinDb.Groups.FirstOrDefault(q => q.Hash == cache.GroupSignature); if (group != null) { entity.GroupId = group.Id; } return(entity); }
private BulletinCache ToBulletinCache(Bulletin entity) { var cache = new BulletinCache(); cache.Title = entity.Title; cache.Name = entity.Title; cache.Description = entity.Description; cache.Images = entity.Images; cache.Price = entity.Price; cache.PublicationDate = entity.DatePublication; var group = GroupHelper.GetGroupSignature2(entity.Id); if (group != null) { cache.CurrentGroup = group.ToString(); } return(cache); }