public ActionResult DeleteItem(int id, string itemID) { if (string.IsNullOrWhiteSpace(itemID)) { return(new HttpNotFoundResult()); } var capsuleDB = Database.Capsules.SingleOrDefault(p => p.CapsuleId == id && p.UserId == Username); if (capsuleDB == null) { return(new HttpNotFoundResult()); } var item = capsuleDB.CapsulesItems.SingleOrDefault(p => p.ItemId == itemID); if (item == null) { return(new HttpNotFoundResult()); } DeleteItemViewModel model = new DeleteItemViewModel(); LoadCapsule(capsuleDB, model); model.Item = ItemViewModelLight.Create(ItemsXml, item.ItemId); model.Quantity = item.Quantity; return(View(model)); }
public ActionResult _ChartTitle(DateGrouping grouping, string itemId, bool accumulative) { var model = new ChartTitleViewModel(); model.Grouping = grouping; model.Item = ItemViewModelLight.Create(ItemsXml, itemId); model.Accumulative = accumulative; return(PartialView("_ChartTitle", model)); }
public ActionResult DateCharts(DateGrouping?grouping, string itemId, bool?accumulative) { var reproduccionesDB = Database.SpawnsCapsulesItems .Where(p => p.SpawnsCapsules.Spawns.UserId == Username) .Select(s => s.ItemId) .Distinct() .ToList(); ChartsViewModel model = new ChartsViewModel(); model.Grouping = grouping ?? DateGrouping.Week; model.Accumulative = accumulative.GetValueOrDefault(); model.ItemId = itemId; model.ViewableItems = ItemsXml.Where(p => reproduccionesDB.Contains(p.ItemId)).Select(q => new { q.ItemId, Description = q.Description() }).ToDictionary(r => r.ItemId, s => s.Description); model.ChartTitle = new ChartTitleViewModel { Grouping = model.Grouping, Item = ItemViewModelLight.Create(ItemsXml, model.ItemId), Accumulative = model.Accumulative }; return(View(model)); }