public ActionResult DeleteConfirmed(int id) { ReturnSite returnsite = db.ReturnSite.Find(id); db.ReturnSite.Remove(returnsite); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(ReturnSite returnsite) { if (ModelState.IsValid) { db.Entry(returnsite).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(returnsite)); }
// // GET: /ReturnSite/Delete/5 public ActionResult Delete(int id = 0) { ReturnSite returnsite = db.ReturnSite.Find(id); if (returnsite == null) { return(HttpNotFound()); } return(View(returnsite)); }
protected void InitDDL(string ddlName, ReturnSite returnsite, string Type) { int ReturnTypeID = 0; ReturnTypeID = (returnsite != null ? int.Parse(returnsite.ReturnTypeID.ToString()) : -1); string[] ReturnTypeArray = { "ReturnTypeList" }; var initlist = Enumerable.Empty <object>().Select(r => new { Id = 0, Name = "" }).ToList(); if (ReturnTypeArray.Contains(ddlName)) { initlist = db.ReturnTypes.ToList().Select(x => new { Id = x.TypeID, Name = x.TypeName }).ToList(); } List <SelectListItem> initList = new List <SelectListItem>(); if (!(Type == null || Type.Trim().Length == 0)) { initList.Add(new SelectListItem() { Text = "", Value = "" }); } string selectedvalue = ""; if (returnsite != null) { switch (ddlName) { case "ReturnTypeList": selectedvalue = ReturnTypeID.ToString(); break; default: break; } } foreach (var item in initlist) { initList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString(), Selected = (item.Id.ToString() == selectedvalue) }); } SelectList cList = new SelectList(initList, "Value", "Text"); ViewData[ddlName] = cList; Session[ddlName] = cList; }
public ActionResult Create(ReturnSite returnsite) { if (ModelState.IsValid) { db.ReturnSite.Add(returnsite); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(returnsite)); }
// // GET: /ReturnSite/Details/5 public ActionResult Details(int id = 0) { ReturnSite returnsite = db.ReturnSite.Find(id); if (returnsite == null) { return(HttpNotFound()); } vReturnSite vreturnsite = ViewReturnSite(id); return(View(vreturnsite)); }
// // GET: /ReturnSite/Edit/5 public ActionResult Edit(int id = 0) { ReturnSite returnsite = db.ReturnSite.Find(id); if (returnsite == null) { return(HttpNotFound()); } InitDDLShow(returnsite, ""); vReturnSite vreturnsite = ViewReturnSite(id); return(View(vreturnsite)); }
public vReturnSite ViewReturnSite(int id = 0) { ReturnSite returnsite = db.ReturnSite.Find(id); ReturnType returntype = db.ReturnTypes.Where(x => x.TypeID == returnsite.ReturnTypeID).FirstOrDefault(); vReturnSite vreturnsite = new vReturnSite { SiteID = returnsite.SiteID, SiteNAME = returnsite.SiteNAME, ReturnTypeID = returnsite.ReturnTypeID, ReturnTypeName = returntype.TypeName }; return(vreturnsite); }
public override string Print(bool link = true, DwarfObject pov = null) { string eventString = GetYearTime(); if (Artifact != null) { eventString += Artifact.ToLink(link, pov); } else { if (string.IsNullOrEmpty(ItemType)) { eventString += " an unknown item "; } else { eventString += " a "; if (!string.IsNullOrWhiteSpace(Material)) { eventString += Material + " "; } eventString += ItemType; } } eventString += " was stolen "; if (Structure != null) { eventString += "from "; eventString += Structure.ToLink(link, pov); eventString += " "; } eventString += "in "; if (Site != null) { eventString += Site.ToLink(link, pov); } else { eventString += "UNKNOWN SITE"; } eventString += " by "; if (Thief != null) { eventString += Thief.ToLink(link, pov); } else { eventString += "an unknown creature"; } if (ReturnSite != null) { eventString += " and brought to " + ReturnSite.ToLink(); } if (!(ParentCollection is Theft)) { eventString += PrintParentCollection(link, pov); } eventString += "."; return(eventString); }
protected void InitDDLShow(ReturnSite returnsite, string action) { InitDDL("ReturnTypeList", returnsite, action); }
public ItemStolen(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "histfig": Thief = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; case "entity": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break; case "item": Artifact = world.GetArtifact(Convert.ToInt32(property.Value)); break; case "item_type": ItemType = property.Value.Replace("_", " "); break; case "item_subtype": ItemSubType = property.Value; break; case "mat": Material = property.Value; break; case "mattype": MaterialType = Convert.ToInt32(property.Value); break; case "matindex": MaterialIndex = Convert.ToInt32(property.Value); break; case "stash_site": ReturnSite = world.GetSite(Convert.ToInt32(property.Value)); break; case "site": if (Site == null) { Site = world.GetSite(Convert.ToInt32(property.Value)); } break; case "structure": StructureId = Convert.ToInt32(property.Value); break; case "circumstance": switch (property.Value) { case "historical event collection": Circumstance = Circumstance.HistoricalEventCollection; break; case "defeated hf": Circumstance = Circumstance.DefeatedHf; break; case "murdered hf": Circumstance = Circumstance.MurderedHf; break; case "abducted hf": Circumstance = Circumstance.AbductedHf; break; default: if (property.Value != "-1") { property.Known = false; } break; } break; case "circumstance_id": CircumstanceId = Convert.ToInt32(property.Value); break; case "reason": if (property.Value != "-1") { property.Known = false; } break; case "reason_id": if (property.Value != "-1") { property.Known = false; } break; case "theft_method": if (property.Value != "theft") { TheftMethod = property.Value; } break; } } if (Site != null) { Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId); } Thief.AddEvent(this); Site.AddEvent(this); Entity.AddEvent(this); Structure.AddEvent(this); Artifact.AddEvent(this); ReturnSite.AddEvent(this); }