public PostServices(IAnimaniaConsoleContext context, ILocationServices locationServices, IAnimalTypeServices animalTypeServices, IBreedTypeServices breedTypeServices) { this.context = context; this.locationServices = locationServices; this.animalTypeServices = animalTypeServices; this.breedTypeServices = breedTypeServices; }
public byte GetAnimalTypeIdByAnimalTypeName(IAnimaniaConsoleContext context, string animalTypeName) { var animalTypeId = context.AnimalTypes .Where(x => x.AnimalTypeName == animalTypeName) .Select(x => x.Id) .SingleOrDefault(); if (animalTypeId == 0) { throw new ArgumentException("Such type of Animal does not exist"); } return(animalTypeId); }
public int GetLocationIdByLocationName(IAnimaniaConsoleContext context, string locationName) { var locationId = context.Locations .Where(x => x.LocationName == locationName) .Select(x => x.Id) .SingleOrDefault(); if (locationId == 0) { throw new ArgumentException("Such Location does not exist"); } return(locationId); }
public BreedTypeServices(IAnimaniaConsoleContext ctx, IMapper mapper) { this.context = ctx; this.mapper = mapper; }
public UserServices(IAnimaniaConsoleContext ctx, IMapper mapper, IUserSessionModel session) { this.Session = session; this.Context = ctx; this.Mapper = mapper; }