public string get_formulation_value(string drugid) { drug_value = (VCRI_DAL.Drug)(from p in dbContext.Drugs select p).Where(p => p.drug_Code.Equals(drugid)).FirstOrDefault(); formula_value = (VCRI_DAL.Formulation)dbContext.Formulations.Find(drug_value.formulation_Code); stock_value = (VCRI_DAL.Stock)(from p in dbContext.Stocks select p).Where(p => p.stock_Code.Equals(drugid)).Where(p => p.expiry_Date >= DateTime.Now).FirstOrDefault(); return(formula_value.shortName + "," + stock_value.stock_BalanceQuantity); }
public bool Delete_stock(String drugid) { try { stock_value = (VCRI_DAL.Stock)(dbContext.Stocks.Where(p => p.stock_Code.Equals(drugid)).FirstOrDefault()); dbContext.Stocks.Remove(stock_value); dbContext.SaveChanges(); return(true); } catch (Exception e) { return(false); } }