public static DAL.Clerk DtoToDAL(ClerkDTO clerkDTO) { DAL.Clerk clerkDAL = new DAL.Clerk(); clerkDAL.ClerkKey = clerkDTO.ClerkKey; clerkDAL.ClerkFName = clerkDTO.ClerkFName; clerkDAL.ClerkLName = clerkDTO.ClerkLName; clerkDAL.ClerkPassword = clerkDTO.ClerkPassword; clerkDAL.IfManager = clerkDTO.IfManager; return(clerkDAL); }
public static ClerkDTO AddNewClerk(ClerkDTO newClerk, ref string message) { DAL.Clerk IfPasswordExists = db.Clerks.FirstOrDefault(c => c.ClerkPassword == newClerk.ClerkPassword); if (IfPasswordExists != null) { message = "סיסמא זו קיימת במערכת, אנא הקש סיסמא חדשה"; return(null); } DAL.Clerk clerkDAL = DtoToDAL(newClerk); db.Clerks.Add(clerkDAL); db.SaveChanges(); return(newClerk); }
public static ClerkDTO ClerkExsits(ClerkDTO clerk) { return(new ClerkDTO(db.Clerks.FirstOrDefault(p => p.ClerkPassword == clerk.ClerkPassword))); }