Example #1
0
        public void Add(PetCreateServiceModel model)
        {
            var pet = new Pet()
            {
                Name        = model.Name,
                Birthdate   = model.Birthdate,
                Gender      = model.Gender,
                Price       = model.Price,
                Description = model.Description,
                BreedId     = model.BreedId,
                CategoryId  = model.CategoryId,
                OrderId     = model.OrderId
            };

            this.data.Pets.Add(pet);

            this.data.SaveChanges();
        }
Example #2
0
        public PetCreateServiceModel Edit(int id)
        {
            var pet = this.data.Pets
                      .Where(p => p.Id == id)
                      .FirstOrDefault();

            var petToProject = new PetCreateServiceModel
            {
                Name        = pet.Name,
                Birthdate   = pet.Birthdate,
                Gender      = pet.Gender,
                Price       = pet.Price,
                Description = pet.Description,
                BreedId     = pet.BreedId,
                CategoryId  = pet.CategoryId,
                OrderId     = pet.OrderId
            };

            return(petToProject);
        }