public PRODUCTS_TBL compaireProductPrice(PRODUCTS_TBL product) { using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities()) { return(null); } }
public static INSURANCE_TBL the_worth_hmo(int age, string categoryName) { categ = db.CATEGORIES_TBL.Where(g => g.categoryName == categoryName).FirstOrDefault(); prod = db.PRODUCTS_TBL.Where(g => g.categoryId == categ.categoriesId).FirstOrDefault(); price1 = db.PRICEs.Where(g => g.productId == prod.productId).FirstOrDefault(); insurance = db.INSURANCE_TBL.Where(g => g.insuranceId == price1.insuranceId).FirstOrDefault(); //age = db.AGE_TBL.Where(g => g.begins >= age && s=>s.ends <= age).FirstOrDefault(); return(insurance); }
//public static int addClerk(string userName, string tz, string telephone, string mail, string adress,bool isAdmin) //{ // use = db.USERS_TBL.Where(g => g.tz == tz).FirstOrDefault(); // if (use == null) // { // Random rand = new Random(); // db.USERS_TBL.Add(new USERS_TBL() { userName = userName, adress = adress, isAdmin=isAdmin, mail = mail, telephone = telephone, tz = tz }); // db.SaveChanges(); // return 0; // } // return 1; //} public static void deleteProduct(int productid) { prod = db.PRODUCTS_TBL.Where(g => g.productId == productid).FirstOrDefault(); if (prod != null) { db.PRODUCTS_TBL.Remove(db.PRODUCTS_TBL.Find(prod)); db.SaveChanges(); } }
public static PRODUCTS_DTO CastToDTO(PRODUCTS_TBL a) { return(new PRODUCTS_DTO { productId = a.productId, description = a.description, categoryId = a.categoryId, imag = a.imag, name = a.name }); }
public static HMO_TBL GetHmoByProduct(PRODUCTS_TBL product) { using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities()) { INSURANCE_TBL insurance = InsuranceModule.GetProductInsurance(product); if (insurance != null) { HMO_TBL hmo = ctx.HMO_TBL.Where(u => u.hmoId == insurance.hmoId).FirstOrDefault(); } return(null); } }
public IHttpActionResult GetProductInsurance(PRODUCTS_TBL product) { try { InsuranceModule.GetProductInsurance(product); return(Ok()); } catch (Exception) { return(InternalServerError()); } }
public IHttpActionResult GetHmoByProduct(PRODUCTS_TBL product) { try { HmoModule.GetHmoByProduct(product); return(Ok()); } catch (Exception) { return(InternalServerError()); } }
public static PRICE GetProductPrice(PRODUCTS_TBL product) { using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities()) { var productdetail = ProductsCRUD.ReadById(ctx, product.productId); if (productdetail != null) { PRICE price = ctx.PRICEs.Where(u => u.productId == product.productId).FirstOrDefault(); return(price); } return(null); } }
//create public static int Create(PRODUCTS_DTO product) { using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities()) { // ctx.PRODUCTS_TBL.Add(new PRODUCTS_TBL { name = product.name, description = product.description, categoryId = product.categoryId }); PRODUCTS_TBL newProduct = new PRODUCTS_TBL() { name = product.name, description = product.description, categoryId = product.categoryId, imag = product.imag }; ctx.PRODUCTS_TBL.Add(newProduct); ctx.SaveChanges(); var lastProduct = ctx.PRODUCTS_TBL.LastOrDefault(); return(lastProduct.productId); } }