public async Task <ResponseModel> Delete(TrainingCourseDocumentModel model)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                TrainingCourseDocument md = await _context.TrainingCourseDocumentRepository.FirstOrDefaultAsync(m => m.Id == model.Id);

                if (!md.RowVersion.SequenceEqual(model.RowVersion))
                {
                    response.ResponseStatus = Core.CommonModel.Enums.ResponseStatus.OutOfDateData;
                    return(response);
                }

                md.Deleted    = true;
                md.UpdateBy   = base.UserId;
                md.UpdateDate = DateTime.Now;

                _context.TrainingCourseDocumentRepository.Update(md);

                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
        public async Task <ResponseModel> Item(int id)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                TrainingCourseDocument md = await _context.TrainingCourseDocumentRepository.FirstOrDefaultAsync(m => m.Id == id);

                if (md == null)
                {
                    throw new NullParameterException();
                }

                TrainingCourseDocumentModel model = new TrainingCourseDocumentModel()
                {
                    Id          = md.Id,
                    Name        = md.Name,
                    Description = md.Description,
                    FileId      = md.FileId,
                    IsActive    = md.IsActive,
                    RowVersion  = md.RowVersion,
                };

                response.Result = model;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
        public async Task <ResponseModel> Insert(TrainingCourseDocumentModel model)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                TrainingCourseDocument md = new TrainingCourseDocument();

                md.Name        = model.Name;
                md.Description = model.Description;
                md.FileId      = model.FileId;
                md.IsActive    = model.IsActive;
                md.CreateBy    = base.UserId;
                md.CreateDate  = DateTime.Now;

                await _context.TrainingCourseDocumentRepository.AddAsync(md).ConfigureAwait(true);

                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }