public async Task <bool> ResetAssignementAsync(Assignement assignement) { if (int.TryParse(assignement.Id, out int assignementId)) { SqlAssignement sqlAssignement = await dbContext.SqlAssignements.FirstOrDefaultAsync(x => x.Id == assignementId); sqlAssignement.DeactivationDate = null; await dbContext.SaveChangesAsync(); return(true); } return(false); }
} //return a collection of user relation public async Task <bool> DeleteAssignement(string id) { if (int.TryParse(id, out int assignementId)) { SqlAssignement sqlAssignement = await dbContext.SqlAssignements.FirstOrDefaultAsync(x => x.Id == assignementId); ObjectEmptyFromDb(sqlAssignement); sqlAssignement.DeactivationDate = DateTime.UtcNow; sqlAssignement.LastEdit = DateTime.UtcNow; await dbContext.SaveChangesAsync(); return(true); } throw new NullReferenceException(Resource.InvalidOperation); } // set deactivation date of a specific relation