コード例 #1
0
        public async Task <bool> DeleteClassStudyMat(ClassStudyMeterialsBM entity)
        {
            bool rtnResult = false;
            Tblmclassmeterials oClassroomStudyMat = await _DBContext.Tblmclassmeterials.Where(c => c.Id.Equals(entity.Id)).FirstOrDefaultAsync();

            if (oClassroomStudyMat != null)
            {
                entity.FileType       = oClassroomStudyMat.FileType;
                entity.DocName        = oClassroomStudyMat.DocName;
                entity.DocDescription = oClassroomStudyMat.DocDescription;
                entity.ClassRefID     = oClassroomStudyMat.ClassRefId;
                entity.CreatedOn      = oClassroomStudyMat.CreatedOn;

                _DBContext.Tblmclassmeterials.Remove(oClassroomStudyMat);

                int result = await _DBContext.SaveChangesAsync();

                if (result > 0)
                {
                    rtnResult = true;
                }
            }

            return(rtnResult);
        }
コード例 #2
0
        public async Task <bool> InsertClassStudyMat(ClassStudyMeterialsBM entity)
        {
            bool rtnResult = false;
            Tblmclassmeterials DBClassroom = new Tblmclassmeterials
            {
                Id             = entity.Id,
                DocType        = entity.DocType,
                DocName        = entity.DocName,
                DocDescription = entity.DocDescription,
                ClassRefId     = entity.ClassRefID,
                FileType       = entity.FileType,
                CreatedOn      = entity.CreatedOn
            };

            ClassStudyMatEntities.Add(DBClassroom);
            int result = await _DBContext.SaveChangesAsync();

            if (result > 0)
            {
                rtnResult = true;
            }

            return(rtnResult);
        }