public bool EntityExist(INameId entity) { if (entity == null) { return(false); } return(_repository.Any(p => p.Id == entity.Id || p.Name.ToLower() == entity.Name.ToLower())); }
// 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 }); }
private Product GetProduct(INameId productNameId) { var product = _productsService.GetEntityById(productNameId.Id); if (product != null) { return(product); } else { throw new EntityNotFoundException("Товар", product.Id); } }
public bool EntityExist(INameId entity) { return(_nameIdService.EntityExist(entity)); }
public NameId(INameId nameId) { Id = nameId?.Id ?? default(Guid); Name = nameId?.Name; }
public bool ProviderExist(INameId provider) { return(_providersService.EntityExist(provider)); }
public bool CategoryExist(INameId category) { return(_productCategoriesService.EntityExist(category)); }