//[HttpGet] public ActionResult Medicine_Supply() { DataBase_Gateway aGateway = new DataBase_Gateway(); stock_tb asStockTb = new stock_tb(); ViewBag.Dis = aGateway.get_districtdata(); ViewBag.Med = aGateway.get_medicinedata(); return(View()); }
public ActionResult Medicine_Supply(string districtId, string thanaId, string centerId, List <temp1> obj) { DataBase_Gateway aGateway = new DataBase_Gateway(); List <district_tb> aDistrictTbs = aGateway.get_districtdata(); List <medicine_tb> ameTbs = aGateway.get_medicinedata(); ViewBag.Dis = aDistrictTbs; ViewBag.Med = ameTbs; try { obj.RemoveAll(item => item == null); List <temp1> aTemp1s = new List <temp1>(); aTemp1s = obj; aTemp1s.RemoveAll(item => item.id == null); string check1 = ""; string check2 = ""; //List<stock_tb> aList = new List<stock_tb>(); List <total_stock_tb> aList = new List <total_stock_tb>(); foreach (temp1 item in aTemp1s) { total_stock_tb asStockTb = new total_stock_tb(); if (item.id != null && item.text2 != null) { asStockTb.centerID = Convert.ToInt32(centerId); check1 = aGateway.getCenterNamebyCenterId(Convert.ToInt32(centerId)); if (check1 != null) { asStockTb.centerName = check1; } asStockTb.medicineID = Convert.ToInt32(item.id); check2 = aGateway.getMedNamebyMedId(Convert.ToInt32(item.id)); if (check2 != null) { asStockTb.medicineName = check2; } asStockTb.stock = Convert.ToInt32(item.text2); } aList.Add(asStockTb); } //aGateway.insert_stock_data(aList); aGateway.populateStockData(aList); } catch (NullReferenceException ex) { } return(View()); }