示例#1
0
        public Models.Tutorial.StudentTutorialModel GetStudentTutorialByID(int StudentTutorialID)
        {
            BusinessLogic.Tutorial.StudentTutorialManager StudentTutorialManager = new BusinessLogic.Tutorial.StudentTutorialManager();
            BusinessEntity.Tutorial.StudentTutorialEntity StudentTutorial        = StudentTutorialManager.GetStudentTutorialByID(StudentTutorialID);

            return(new Models.Tutorial.StudentTutorialModel(StudentTutorial));
        }
        public BusinessEntity.Result DeleteStudentTutorial(BusinessEntity.Tutorial.StudentTutorialEntity StudentTutorial)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblStudentTutorials.Find(StudentTutorial.ID);
                if (original != null)
                {
                    e.tblStudentTutorials.Remove(e.tblStudentTutorials.Where(x => x.ID == StudentTutorial.ID).First());
                    e.SaveChanges();

                    result.Message = "Deleted Successfully.";
                    result.Status  = true;
                    return(result);
                }
                else
                {
                    result.Message = "Failed to delete";
                    result.Status  = false;
                    return(result);
                }
            }
            catch (Exception)
            {
                result.Message = "Failed to delete";
                result.Status  = false;
                return(result);
            }
        }
        public BusinessEntity.Result UpdateStudentTutorial(BusinessEntity.Tutorial.StudentTutorialEntity StudentTutorial)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblStudentTutorials.Find(StudentTutorial.ID);
                if (original != null)
                {
                    e.Entry(original).CurrentValues.SetValues(StudentTutorial);
                    e.SaveChanges();

                    result.Message = "Updated Successfully.";
                    result.Status  = true;
                    return(result);
                }
                else
                {
                    result.Message = "Failed to update";
                    result.Status  = false;
                    return(result);
                }
            }
            catch (Exception)
            {
                result.Message = "Failed to update";
                result.Status  = false;
                return(result);
            }
        }
示例#4
0
        public StudentTutorialModel(BusinessEntity.Tutorial.StudentTutorialEntity studentTutorial)
        {
            this.ID = studentTutorial.ID;

            this.Student      = new StudentModel(studentTutorial.Student);
            this.GradeSection = new GradeSectionModel(studentTutorial.GradeSection);

            this.CreatedBy   = studentTutorial.CreatedBy;
            this.CreatedDate = studentTutorial.CreatedDate;
            this.UpdatedBy   = studentTutorial.UpdatedBy;
            this.UpdatedDate = studentTutorial.UpdatedDate;
        }
示例#5
0
        public T MapToEntity <T>() where T : class
        {
            BusinessEntity.Tutorial.StudentTutorialEntity studentTutorial = new BusinessEntity.Tutorial.StudentTutorialEntity();
            studentTutorial.ID = this.ID;

            studentTutorial.Student      = this.Student.MapToEntity <BusinessEntity.Admission.StudentEntity>();
            studentTutorial.GradeSection = this.GradeSection.MapToEntity <BusinessEntity.Lookup.GradeSectionEntity>();

            studentTutorial.CreatedBy   = this.CreatedBy;
            studentTutorial.CreatedDate = this.CreatedDate;
            studentTutorial.UpdatedBy   = this.UpdatedBy;
            studentTutorial.UpdatedDate = this.UpdatedDate;

            return(studentTutorial as T);
        }
        public BusinessEntity.Result SaveStudentTutorial(BusinessEntity.Tutorial.StudentTutorialEntity StudentTutorial)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                e.tblStudentTutorials.Add(StudentTutorial.MapToModel <DataAccessLogic.tblStudentTutorial>());
                e.SaveChanges();

                result.Message = "Saved Successfully.";
                result.Status  = true;
                return(result);
            }
            catch (Exception)
            {
                result.Message = "Failed to save";
                result.Status  = false;
                return(result);
            }
        }