示例#1
0
        public Owner DeleteOwner(Owner owner)
        {
            var ownerToRemove = _context.Remove(owner).Entity;

            _context.SaveChanges();
            return(ownerToRemove);
        }
示例#2
0
        public Pet DeletePet(Pet deletePet)
        {
            var removed = _ctx.Remove(deletePet).Entity;

            _ctx.SaveChanges();
            return(removed);
        }
示例#3
0
 public Pet DeletePet(Pet pet)
 {
     //Pet petRemoved = _context.Remove(new Pet { id = pet.id}).Entity;
     _context.Remove(pet);
     _context.SaveChanges();
     return(pet);
 }
示例#4
0
        public Owner DeleteOwner(Owner owner)
        {
            var removed = _ctx.Remove(owner).Entity;

            _ctx.SaveChanges();
            return(removed);
        }
示例#5
0
 public User Update(User userUpdated)
 {
     _ctx.Attach(userUpdated).State = EntityState.Modified;
     _ctx.Remove(_ctx.Users.Where(u => u.Id == userUpdated.Id));
     _ctx.Entry(userUpdated).Reference(u => u.Owner).IsModified = true;
     _ctx.SaveChanges();
     return(userUpdated);
 }
示例#6
0
        public void Remove(long id)
        {
            var entityRemoved = _context.Remove(new User {
                Id = id
            }).Entity;

            _context.SaveChanges();
        }
示例#7
0
        public User DeleteUser(int id)
        {
            var userRemoved = _ctx.Remove(new User {
                UserId = id
            }).Entity;

            _ctx.SaveChanges();
            return(userRemoved);
        }
示例#8
0
        public Pet DeletePet(int id)
        {
            var entityToRemove = _context.Remove(new Pet {
                Id = id
            }).Entity;

            _context.SaveChanges();
            return(entityToRemove);
        }
示例#9
0
        public PetType DeletePetType(int id)
        {
            var petTypeRemoved = _ctx.Remove(new PetType {
                petTypeId = id
            }).Entity;

            _ctx.SaveChanges();
            return(petTypeRemoved);
        }
示例#10
0
        public Pet Delete(int id)
        {
            var petRemoved = _ctx.Remove(new Pet {
                Id = id
            }).Entity;

            _ctx.SaveChanges();
            return(petRemoved);
        }
示例#11
0
        public Color Delete(int id)
        {
            var color = _ctx.Remove(new Color {
                id = id
            }).Entity;

            _ctx.SaveChanges();
            return(color);
        }
示例#12
0
        public Owner Delete(int id)
        {
            var ownerRemoved = _ctx.Remove(new Owner {
                Id = id
            }).Entity;

            _ctx.SaveChanges();
            return(ownerRemoved);
        }
        public Owner Delete(int id)
        {
            var ownerToDelete = _context.Remove(new Owner {
                Id = id
            }).Entity;

            _context.SaveChanges();
            return(ownerToDelete);
        }
示例#14
0
        public Pet RemovePet(int id)
        {
            var entityRemoved = _context.Remove(new Pet {
                PetId = id
            }).Entity;

            _context.SaveChanges();
            return(entityRemoved);
        }
示例#15
0
        public Owner DeleteOwner(int inputId)
        {
            var ownerRemoved = _ctx.Remove(new Owner()
            {
                Id = inputId
            }).Entity;

            _ctx.SaveChanges();
            return(ownerRemoved);
        }
示例#16
0
        public Pet DeletePet(int id)
        {
            var entity = _ctx.Remove(new Pet()
            {
                Id = id
            });

            _ctx.SaveChanges();
            return(entity.Entity);
        }
        public Color DeleteColor(int id)
        {
            var deleteColor = _ctx.Remove(new Color()
            {
                Id = id
            }).Entity;

            _ctx.SaveChanges();
            return(deleteColor);
        }
        public Owner DeleteOwner(int id)
        {
            var owner = _ctx.Remove(new Owner()
            {
                Id = id
            }).Entity;

            _ctx.SaveChanges();
            return(owner);
        }
示例#19
0
        public Pet DeletePetRepo(int inputId)
        {
            var petRemove = _ctx.Remove(new Pet()
            {
                id = inputId
            }).Entity;

            _ctx.SaveChanges();
            return(petRemove);
        }
示例#20
0
        public Pet DeletePet(int id)
        {
            var deletePet = _ctx.Remove(new Pet()
            {
                Id = id
            }).Entity;

            _ctx.SaveChanges();
            return(deletePet);
        }
        public Owner DeleteOwner(int id)
        {
            //  var petsToRemove = _ctx.Pets.Where(p => p.PetsOwner.OwnerId == id);
            //  _ctx.RemoveRange(petsToRemove);
            var ownerRemoved = _ctx.Remove(new Owner {
                ownerId = id
            }).Entity;

            _ctx.SaveChanges();
            return(ownerRemoved);
        }
示例#22
0
        public Pet Delete(int id)
        {
            var petToDelete = _context.Remove(new Pet {
                Id = id
            }).Entity;

            _context.SaveChanges();
            return(petToDelete);
            //var petToDelete = _context.Pets.Remove(ReadById(id)).Entity;
            //_context.SaveChanges();
            //return petToDelete;
        }
示例#23
0
        /// <summary>
        /// Deletes the specific owner from the DB.
        /// </summary>
        /// <param name="id"></param>
        public void DeleteOwner(int id)
        {
            //var pets = _ctx.Pets.Where(x => x.Owner.Id == id);
            //pets.ToList().ForEach(x =>
            //{
            //    x.Owner = null;
            //    _ctx.Update(x);
            //});

            _ctx.Remove(_ctx.Owners.First(x => x.Id == id));
            _ctx.SaveChanges();
        }
示例#24
0
        public Pet DeletePet(int id)
        {
            var entityRemoved = _context.Remove(new Pet {
                id = id
            }).Entity;

            _context.SaveChanges();
            return(entityRemoved);

            //Øverste sender kun 1 request til DB, mens den neden under sender 2.

            /*var removing = _context.pets.FirstOrDefault(p => p.ID == pet.ID);
             * _context.Remove(removing);
             * _context.SaveChanges();
             * return removing;*/
        }
示例#25
0
        public bool DeleteOwner(int id)
        {
            var entityEntry = _ctx.Remove(new Owner()
            {
                ID = id
            });

            _ctx.SaveChanges();
            if (entityEntry == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
示例#26
0
        public async Task <IActionResult> Delete(int id)
        {
            using (var _db = new PetShopContext())
            {
                try
                {
                    var purchale = await _db.Purchale.FindAsync(id);

                    _db.Remove(purchale);
                    await _db.SaveChangesAsync();

                    return(Ok());
                }
                catch (DbUpdateConcurrencyException)
                {
                    return(BadRequest());
                }
            }
        }
示例#27
0
 public Owner DeleteOwner(Owner owner)
 {
     _context.Remove(owner);
     _context.SaveChanges();
     return(owner);
 }
示例#28
0
 public void Delete <T>(T entity) where T : class
 {
     _context.Remove(entity);
 }