public ActionResult Chk(Collection0[] message) { foreach (Collection0 aCollection0 in message) { AllocateMedicine allocateMedicine = new AllocateMedicine(); int district = aCollection0.DistrictId; int upazila = aCollection0.UpazilaId; var relations = db.DistrictUpazilaRelation.FirstOrDefault(p => p.UpazilaId == upazila && p.DistrictId == district); if (relations.Id == 0) { } else { allocateMedicine.MedicineId = Convert.ToInt16(aCollection0.MedicineId); allocateMedicine.DistrictUpazilaId = relations.Id; allocateMedicine.ServiceCenterId = Convert.ToInt16(aCollection0.ServiceCenterId); ; allocateMedicine.Quantity = Convert.ToInt16(aCollection0.Quantity); db.AllocateMedicines.Add(allocateMedicine); db.SaveChanges(); } } return(Json(message, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteConfirmed(int id) { AllocateMedicine allocatemedicine = db.AllocateMedicines.Find(id); db.AllocateMedicines.Remove(allocatemedicine); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "AllocateMedicineId,DistrictThanaRelationshipId,ServiceCenterId,MedicineId")] AllocateMedicine allocatemedicine) { if (ModelState.IsValid) { db.Entry(allocatemedicine).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MedicineId = new SelectList(db.Medicines, "MedicineId", "Name", allocatemedicine.MedicineId); ViewBag.ServiceCenterId = new SelectList(db.ServiceCenters, "ServiceCenterId", "Name", allocatemedicine.ServiceCenterId); return(View(allocatemedicine)); }
// GET: /AllocateMedicine/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AllocateMedicine allocatemedicine = db.AllocateMedicines.Find(id); if (allocatemedicine == null) { return(HttpNotFound()); } return(View(allocatemedicine)); }
// GET: /AllocateMedicine/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AllocateMedicine allocatemedicine = db.AllocateMedicines.Find(id); if (allocatemedicine == null) { return(HttpNotFound()); } ViewBag.MedicineId = new SelectList(db.Medicines, "MedicineId", "Name", allocatemedicine.MedicineId); ViewBag.ServiceCenterId = new SelectList(db.ServiceCenters, "ServiceCenterId", "Name", allocatemedicine.ServiceCenterId); return(View(allocatemedicine)); }
public ActionResult Create( [Bind(Include = "Id,ServiceCenterId,Quantity,MedicineId,DistrictUpazilaId")] AllocateMedicine allocatemedicine) { return(RedirectToAction("Create")); }