public string get_formulation_value(string drugid) { VCR_DAL.Drug drug_details = (VCR_DAL.Drug)(from p in dbContext.Drugs select p).Where(p => p.Drug_Code.Equals(drugid)).FirstOrDefault(); VCR_DAL.Formulation formulation_details = (VCR_DAL.Formulation)dbContext.Formulations.Find(drug_details.Formulation_code); VCR_DAL.Stock stock_details = (VCR_DAL.Stock)(from p in dbContext.Stocks select p).Where(p => p.Drug_Code.Equals(drugid)).Where(p => p.Expiry_Date >= DateTime.Now).FirstOrDefault(); return(formulation_details.ShortName + "," + stock_details.Quantity); }
public bool Delete_formulation(String formulaid) { try { formula_value = (VCR_DAL.Formulation)(dbContext.Formulations.Where(p => p.Formulation_code.Equals(formulaid)).FirstOrDefault()); dbContext.Formulations.Remove(formula_value); dbContext.SaveChanges(); return(true); } catch (Exception e) { return(false); } }