Пример #1
0
        public static Domain.Shop MapFromDAL(DAL.App.DTO.DomainLikeDTO.Shop shop)
        {
            var res = shop == null ? null : new Domain.Shop
            {
                Id           = shop.Id,
                ShopName     = new MultiLangString(shop.ShopName),
                ShopAddress  = new MultiLangString(shop.ShopAddress),
                ShopContact  = new MultiLangString(shop.ShopContact),
                ShopContact2 = new MultiLangString(shop.ShopContact2)
            };

            return(res);
        }
Пример #2
0
        public override Shop Update(Shop entity)
        {
            var entityInDb = RepositoryDbSet
                             .Include(a => a.ShopName).ThenInclude(t => t.Translations)
                             .Include(a => a.ShopAddress).ThenInclude(t => t.Translations)
                             .Include(a => a.ShopContact).ThenInclude(t => t.Translations)
                             .Include(a => a.ShopContact2).ThenInclude(t => t.Translations)
                             .FirstOrDefault(x => x.Id == entity.Id);

            if (entityInDb == null)
            {
                return(entity);
            }

            entityInDb.ShopName.SetTranslation(entity.ShopName);
            entityInDb.ShopAddress.SetTranslation(entity.ShopAddress);
            entityInDb.ShopContact.SetTranslation(entity.ShopContact);
            entityInDb.ShopContact2.SetTranslation(entity.ShopContact2);

            return(entity);
        }