public void Delete(int id) { try { RecipeIngredient recipeIngredient = dbContext.RecipeIngredient.FirstOrDefault(x => x.Id == id); if (recipeIngredient != null) { dbContext.Remove(recipeIngredient); dbContext.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void Delete(int id) { try { RegisteredUserRecipe registeredUserRecipe = dbContext.RegisteredUserRecipe.FirstOrDefault(x => x.Id == id); if (registeredUserRecipe != null) { dbContext.Remove(registeredUserRecipe); dbContext.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void Delete(int id) { try { Warning warning = dbContext.Warning.FirstOrDefault(x => x.Id == id); if (warning != null) { //// Baja lógica //blockedWord.Active = false; //dbContext.Update(blockedWord); //dbContext.SaveChanges(); //// Procedure //dbContext.DeleteBadWord(); ////// Baja física dbContext.Remove(warning); dbContext.SaveChanges(); ////Si se tiene FK, borrar tambien de las tablas que influye //BlockedWord blockedWord2 = dbContext.BlockedWord // .Include(x => x.TablaDependiente) // .FirstOrDefault(x => x.Id == id); //dbContext.Remove(blockedWord2); //dbContext.SaveChanges(); } } catch (Exception ex) { throw ex; } }