Exemplo n.º 1
0
        public bool EntityExist(INameId entity)
        {
            if (entity == null)
            {
                return(false);
            }

            return(_repository.Any(p => p.Id == entity.Id || p.Name.ToLower() == entity.Name.ToLower()));
        }
Exemplo n.º 2
0
 // update: without generics as Marcus Höglund pointed out
 public static IdNameVM HydrateEntityToVM2(this INameId model)
 {
     if (model == null)
     {
         return(null);
     }
     return(new IdNameVM()
     {
         Id = model.Id,
         Name = model.Name
     });
 }
Exemplo n.º 3
0
        private Product GetProduct(INameId productNameId)
        {
            var product = _productsService.GetEntityById(productNameId.Id);

            if (product != null)
            {
                return(product);
            }
            else
            {
                throw new EntityNotFoundException("Товар", product.Id);
            }
        }
Exemplo n.º 4
0
 public bool EntityExist(INameId entity)
 {
     return(_nameIdService.EntityExist(entity));
 }
Exemplo n.º 5
0
 public NameId(INameId nameId)
 {
     Id   = nameId?.Id ?? default(Guid);
     Name = nameId?.Name;
 }
Exemplo n.º 6
0
 public bool ProviderExist(INameId provider)
 {
     return(_providersService.EntityExist(provider));
 }
 public bool CategoryExist(INameId category)
 {
     return(_productCategoriesService.EntityExist(category));
 }