/// <summary> /// Removes a Data Set from the Database and saves it /// </summary> /// <param name="item">The item to delete</param> /// <returns></returns> public bool Remove(PasswordData item) { PASSWORDDATA itemToDelete = db.PASSWORDDATA .FirstOrDefault(x => x.PWID == item.Identifier); db.Remove(itemToDelete); db.SaveChanges(); return(db.PASSWORDDATA.Where(x => x.PWID == item.Identifier) == null); }
public async Task AddDataAsync(PasswordData value) { var data = new PASSWORDDATA { PWID = value.Identifier, PWDATA = value.Password, PWCOMMENT = value.Comments, PWDESCRIPTION = value.Description, USERUSID = userInfo.User.Identifier }; db.PASSWORDDATA.Add(data); await db.SaveChangesAsync(); }
public async Task <bool> RemoveAsync(PasswordData item) { PASSWORDDATA itemToDelete = await db.PASSWORDDATA .Where(x => x.PWID == item.Identifier) .FirstOrDefaultAsync(); db.Remove(itemToDelete); await db.SaveChangesAsync(); var deletedPassword = db.PASSWORDDATA .Where(x => x.PWID == item.Identifier); return(!deletedPassword.Any()); }