Beispiel #1
0
        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);
        }
Beispiel #2
0
        } //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