public BusinessEntity.Result DeleteGradeSection(BusinessEntity.Lookup.GradeSectionEntity GradeSection) { BusinessEntity.Result result = new BusinessEntity.Result(); try { SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities(); var original = e.tblGradeSections.Find(GradeSection.ID); if (original != null) { e.tblGradeSections.Remove(e.tblGradeSections.Where(x => x.ID == GradeSection.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 UpdateGradeSection(BusinessEntity.Lookup.GradeSectionEntity GradeSection) { BusinessEntity.Result result = new BusinessEntity.Result(); try { SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities(); var original = e.tblGradeSections.Find(GradeSection.ID); if (original != null) { e.Entry(original).CurrentValues.SetValues(GradeSection); 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.GradeSectionModel GetGradeSectionByID(int GradeSectionID) { BusinessLogic.Lookup.GradeSectionManager GradeSectionManager = new BusinessLogic.Lookup.GradeSectionManager(); BusinessEntity.Lookup.GradeSectionEntity GradeSection = GradeSectionManager.GetGradeSectionByID(GradeSectionID); return(new Models.Lookup.GradeSectionModel(GradeSection)); }
public BusinessEntity.Result SaveGradeSection(BusinessEntity.Lookup.GradeSectionEntity GradeSection) { BusinessEntity.Result result = new BusinessEntity.Result(); try { SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities(); e.tblGradeSections.Add(GradeSection.MapToModel <DataAccessLogic.tblGradeSection>()); e.SaveChanges(); result.Message = "Saved Successfully."; result.Status = true; return(result); } catch (Exception) { result.Message = "Failed to save"; result.Status = false; return(result); } }