コード例 #1
0
 public List <SecurityDepartmentDetail> GetDepartments()
 {
     using (var context = new SecurityDepartmentEntities())
     {
         var depts = context.SecurityDepartmentDetails.ToList();
         return(depts);
     }
 }
コード例 #2
0
 public long AddNewSecurityPersonel(SecurityPersonnelDetail securityPerson)
 {
     using (var context = new SecurityDepartmentEntities())
     {
         context.SecurityPersonnelDetails.Add(securityPerson);
         context.SaveChanges();
         return(securityPerson.SecurityPersonnelID);
     }
 }
コード例 #3
0
 public SecurityPersonnelDetail GetSecurityDetails(long id)
 {
     using (var context = new SecurityDepartmentEntities())
     {
         var details = context.SecurityPersonnelDetails.SingleOrDefault(x => x.SecurityPersonnelID == id);
         if (details == null)
         {
             return(null);
         }
         details.SecurityDepartmentDetail =
             context.SecurityDepartmentDetails.FirstOrDefault(x => x.SecurityDepartmentID == details.SecurityDepartmentID);
         return(details);
     }
 }