Esempio n. 1
0
        public BusinessEntity.Result DeleteExamType(BusinessEntity.Lookup.ExamTypeEntity ExamType)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblExamTypes.Find(ExamType.ID);
                if (original != null)
                {
                    e.tblExamTypes.Remove(e.tblExamTypes.Where(x => x.ID == ExamType.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);
            }
        }
Esempio n. 2
0
        public BusinessEntity.Result UpdateExamType(BusinessEntity.Lookup.ExamTypeEntity ExamType)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                var original = e.tblExamTypes.Find(ExamType.ID);
                if (original != null)
                {
                    e.Entry(original).CurrentValues.SetValues(ExamType);
                    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);
            }
        }
        public Models.Lookup.ExamTypeModel GetExamTypeByID(int ExamTypeID)
        {
            BusinessLogic.Lookup.ExamTypeManager ExamTypeManager = new BusinessLogic.Lookup.ExamTypeManager();
            BusinessEntity.Lookup.ExamTypeEntity ExamType        = ExamTypeManager.GetExamTypeByID(ExamTypeID);

            return(new Models.Lookup.ExamTypeModel(ExamType));
        }
 public ExamTypeModel(BusinessEntity.Lookup.ExamTypeEntity examType)
 {
     this.ID          = examType.ID;
     this.Name        = examType.Name;
     this.Description = examType.Description;
     this.CreatedBy   = examType.CreatedBy;
     this.CreatedDate = examType.CreatedDate;
 }
        public T MapToEntity <T>() where T : class
        {
            BusinessEntity.Lookup.ExamTypeEntity examType = new BusinessEntity.Lookup.ExamTypeEntity();
            examType.ID          = this.ID;
            examType.Name        = this.Name;
            examType.Description = this.Description;
            examType.CreatedBy   = this.CreatedBy;
            examType.CreatedDate = this.CreatedDate;

            return(examType as T);
        }
Esempio n. 6
0
        public BusinessEntity.Result SaveExamType(BusinessEntity.Lookup.ExamTypeEntity ExamType)
        {
            BusinessEntity.Result result = new BusinessEntity.Result();
            try
            {
                SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities();
                e.tblExamTypes.Add(ExamType.MapToModel <DataAccessLogic.tblExamType>());
                e.SaveChanges();

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