public bool DeleteGroupClass(string groupId) { Guid id = Guid.Parse(groupId); using (var dbConn = new SapremaFinalContext()) { SapClass sapClass = dbConn.SapClass.Where(a => a.ClassGroupId == id).FirstOrDefault(); if (sapClass != null) { //dbConn.SapClass.Remove(sapClass); //dbConn.SaveChanges(); return(true); } else { return(false); } } }
//Adds a created class to the db public bool CreateClass(string classCreatedBy, int classLevel, string classTheme, string classDescription, Guid classGroupId, string classSequence) { using (var dbConn = new SapremaFinalContext()) { SapClass sapClass = new SapClass() { ClassId = Guid.NewGuid(), ClassCreatedBy = classCreatedBy, ClassLevel = classLevel, ClassTheme = classTheme, ClassDescription = classDescription, ClassGroupId = classGroupId, //ClassSequence = classSequence }; dbConn.SapClass.Add(sapClass); dbConn.SaveChanges(); }; return(true); }