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 CATEGORIES_DTO CastToDTO(CATEGORIES_TBL a) { return(new CATEGORIES_DTO { categoryId = a.categoriesId, categoryName = a.categoryName, //parentCategory= a.parentCategory.Value }); }
public static CATEGORIES_TBL isSearchExist(string search_text) { category = db.CATEGORIES_TBL.Where(g => g.categoryName.Contains(search_text)).FirstOrDefault(); if (category != null) { return(category); } else { return(null); } }
//Update //Delete public static void deleteCategory(CATEGORIES_TBL category) { ctx.CATEGORIES_TBL.Remove(ctx.CATEGORIES_TBL.FirstOrDefault(u => u.categoriesId == category.categoriesId)); ctx.SaveChanges(); }