public Owner DeleteOwner(Owner owner) { var ownerToRemove = _context.Remove(owner).Entity; _context.SaveChanges(); return(ownerToRemove); }
public Pet DeletePet(Pet deletePet) { var removed = _ctx.Remove(deletePet).Entity; _ctx.SaveChanges(); return(removed); }
public Pet DeletePet(Pet pet) { //Pet petRemoved = _context.Remove(new Pet { id = pet.id}).Entity; _context.Remove(pet); _context.SaveChanges(); return(pet); }
public Owner DeleteOwner(Owner owner) { var removed = _ctx.Remove(owner).Entity; _ctx.SaveChanges(); return(removed); }
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); }
public void Remove(long id) { var entityRemoved = _context.Remove(new User { Id = id }).Entity; _context.SaveChanges(); }
public User DeleteUser(int id) { var userRemoved = _ctx.Remove(new User { UserId = id }).Entity; _ctx.SaveChanges(); return(userRemoved); }
public Pet DeletePet(int id) { var entityToRemove = _context.Remove(new Pet { Id = id }).Entity; _context.SaveChanges(); return(entityToRemove); }
public PetType DeletePetType(int id) { var petTypeRemoved = _ctx.Remove(new PetType { petTypeId = id }).Entity; _ctx.SaveChanges(); return(petTypeRemoved); }
public Pet Delete(int id) { var petRemoved = _ctx.Remove(new Pet { Id = id }).Entity; _ctx.SaveChanges(); return(petRemoved); }
public Color Delete(int id) { var color = _ctx.Remove(new Color { id = id }).Entity; _ctx.SaveChanges(); return(color); }
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); }
public Pet RemovePet(int id) { var entityRemoved = _context.Remove(new Pet { PetId = id }).Entity; _context.SaveChanges(); return(entityRemoved); }
public Owner DeleteOwner(int inputId) { var ownerRemoved = _ctx.Remove(new Owner() { Id = inputId }).Entity; _ctx.SaveChanges(); return(ownerRemoved); }
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); }
public Pet DeletePetRepo(int inputId) { var petRemove = _ctx.Remove(new Pet() { id = inputId }).Entity; _ctx.SaveChanges(); return(petRemove); }
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); }
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; }
/// <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(); }
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;*/ }
public bool DeleteOwner(int id) { var entityEntry = _ctx.Remove(new Owner() { ID = id }); _ctx.SaveChanges(); if (entityEntry == null) { return(false); } else { return(true); } }
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()); } } }
public Owner DeleteOwner(Owner owner) { _context.Remove(owner); _context.SaveChanges(); return(owner); }
public void Delete <T>(T entity) where T : class { _context.Remove(entity); }