コード例 #1
0
 public PostServices(IAnimaniaConsoleContext context, ILocationServices locationServices, IAnimalTypeServices animalTypeServices, IBreedTypeServices breedTypeServices)
 {
     this.context            = context;
     this.locationServices   = locationServices;
     this.animalTypeServices = animalTypeServices;
     this.breedTypeServices  = breedTypeServices;
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public BreedTypeServices(IAnimaniaConsoleContext ctx, IMapper mapper)
 {
     this.context = ctx;
     this.mapper  = mapper;
 }
コード例 #5
0
 public UserServices(IAnimaniaConsoleContext ctx, IMapper mapper, IUserSessionModel session)
 {
     this.Session = session;
     this.Context = ctx;
     this.Mapper  = mapper;
 }