public ActionResult PreviousSchool(PreviousSchool previousSchool) { if (previousSchool.Id > 0) { SmsRepository.UpdatePreviousSchool(previousSchool); } else { SmsRepository.InsertPreviousSchool(previousSchool); } PreviousSchoolCommon(); return(View()); }
public static void InsertPreviousSchool(PreviousSchool previousSchool) { try { using (var db = new SMSContext()) { db.PreviousSchools.Add(previousSchool); db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static PreviousSchool GetPreviousSchoolByStudentId(int studentId) { var previousSchoolStudentId = new PreviousSchool(); try { using (var db = new SMSContext()) { previousSchoolStudentId = db.PreviousSchools.Single(x => x.Id == studentId); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(previousSchoolStudentId); }
public static void UpdatePreviousSchool(PreviousSchool previousSchool) { try { using (var db = new SMSContext()) { var tempPreviousSchool = db.PreviousSchools.Single(x => x.Id == previousSchool.Id); tempPreviousSchool.StudentId = previousSchool.StudentId; tempPreviousSchool.InstituteName = previousSchool.InstituteName; tempPreviousSchool.JoinDate = previousSchool.JoinDate; tempPreviousSchool.LeaveDate = previousSchool.LeaveDate; } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }