public ActionResult SetItemLocation(ItemLocationModel itemLocationModel) { var Item = db.ItemMaster.Where(p => p.Id == itemLocationModel.ItemId).FirstOrDefault(); Item.RackName = itemLocationModel.RackName; Item.CellInRack = itemLocationModel.CellInRack; db.Entry(Item).State = EntityState.Modified; db.SaveChanges(); var items = db.ItemMaster.Where(p => p.StoreName == "MS").ToList(); return(PartialView("~/Areas/PharmacyModule/Views/PharmacyMaster/_SetItemLocation.cshtml", items)); }
public static async Task <List <ItemLocationModel> > GetItemLocations(this PrimaryDbContext db, SecondaryDbContext sdb) { var items = await sdb.GetItems(); var model = new List <ItemLocationModel>(); foreach (var i in items) { var il = new ItemLocationModel { Item = i, Locations = await db.GetLocations(sdb, i.Id) }; model.Add(il); } return(model); }