Пример #1
0
        public Applicant Delete(int id)
        {
            var applicant = GetById(id);

            if (applicant != null)
            {
                db.Remove(applicant);
            }
            return(applicant);
        }
        public async Task <bool> DeleteAsync(TEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException($"{nameof(DeleteAsync)} entity must not be null");
            }

            try
            {
                _applicantContext.Remove(entity);
                await _applicantContext.SaveChangesAsync();

                return(true);
            }
            catch (Exception)
            {
                throw new Exception($"{nameof(entity)} could not be updated");
            }
        }