public static List <colorDto> GetColorsOfFurniture() { List <colorDto> colors = new List <colorDto>(); using (ProjectZUEntities db = new ProjectZUEntities()) { } }
//הוספת מפעל חדש public static void setFactory(factoryDto newFactory) { using (ProjectZUEntities db = new ProjectZUEntities()) { db.Factories.Add(convertion.FactoryConvertion.ConvertToFactory(newFactory)); db.SaveChanges(); } }
//הוספת משתמש public static void AddNewcustomer(CustomerDto customerDto) { using (ProjectZUEntities db = new ProjectZUEntities()) { //הוספת חדש post db.Customers.Add(convertion.customerConvertion.ConvertToCustomer(customerDto)); db.SaveChanges(); } }
// לקבלת רשימת הצבעים שיש לאתר public static void GetColors() { using (ProjectZUEntities db = new ProjectZUEntities()) { //////החזרת רשימה get List <colorDto> colors = new List <colorDto>(); db.colors.ToList().ForEach(x => { colors.Add(convertion.ColorConvertion.convertToDto(x)); }); } }
public static bool postFuniture(FurnitureFullDto furniturFul) { using (ProjectZUEntities db = new ProjectZUEntities()) { // ColorForFurniture color = new ColorForFurniture(); //שרשור נתונים db.Furnitures.Add(convertion.FurnitureFullconvertion.fullFuntiorConvertionToDto(furniturFul)); db.SaveChanges(); return(true); } }
//לקבלת משתמש שחיפשנו public static CustomerDto GetUser(string email, string password, CustomerDto customerDto)//מקבך DTO { //int colorId, //להוסיף סיסמא using (ProjectZUEntities db = new ProjectZUEntities()) { //חיפוש מסוים get(parametr) Customer customerFind = new Customer(); customerFind = db.Customers.ToList().FirstOrDefault(x => x.CustomersEmail == email && x.CustomersId == password); return(convertion.customerConvertion.ConvertToDto(customerFind)); } }
//שליפת רשימת כל המפעלים public static List <factoryDto> getAllFactories() { using (ProjectZUEntities db = new ProjectZUEntities()) { List <factoryDto> allFactories = new List <factoryDto>(); db.Factories.ToList().ForEach(x => { allFactories.Add(convertion.FactoryConvertion.ConvertToDto(x)); }); return(allFactories); } }
//לקבלת סוגי השרות של מפעל מסוים public static List <typeOfServiceDto> getTypeOfService(factoryDto factory) { using (ProjectZUEntities db = new ProjectZUEntities()) { List <typeOfServiceDto> typeServiseOfFactory = new List <typeOfServiceDto>(); List <TypesOfService> typeOfService = db.TypesOfServices.ToList(); foreach (var item in typeOfService) { if (factory.TypesOfServiceId == item.TypesOfServiceId) { typeServiseOfFactory.Add(convertion.TypeOsServiceConvertion.ConvertionToDto(item)); } } return(typeServiseOfFactory); } }
{//לשאול //פונקציה שמחזירה את שמות החומרי גלם מהם עשוי הרהיט public static List <rawMaterialDto> GetNameMateriaslOfFurniture() { using (ProjectZUEntities db = new ProjectZUEntities()) { List <rawMaterialDto> rawmaterial = new List <rawMaterialDto>(); List <RawMaterial> rawmaterialDB = db.RawMaterials.ToList(); List <Furniture> furnituredB = db.Furnitures.ToList(); foreach (var item in rawmaterialDB) { foreach (var item2 in furnituredB) { if (item.RawMaterialsId == item2.RawMaterialsId) { rawmaterial.Add(convertion.RawMaterialConvertion.RawMaterialConvertionToDto(item)); } } } return(rawmaterial); } }