public ActionResult Create([Bind(Include = "Relation,Closeness,ThoughtsOnCounterpart,Name")] RelationshipPhase relationshipPhase) { pc.RemovePage("Create", "RelationshipPhases"); if (ModelState.IsValid) { relationshipPhase.LastModified = DateTime.Now; var relationship = db.Relationships.Find(PageManager.CurrentRelationship.ID); if (relationship != null) { db.Entry(relationship).State = EntityState.Modified; relationship.LastModified = DateTime.Now; db.SaveChanges(); relationshipPhase.Relationship = relationship; relationshipPhase.RelationshipId = relationship.ID; db.RelationshipPhases.Add(relationshipPhase); db.SaveChanges(); } return(RedirectToAction("Details", new { id = relationshipPhase.ID })); } return(RedirectToAction("Create")); }
public ActionResult DeleteConfirmed(int id) { pc.RemovePage("Delete", "RelationshipPhases"); RelationshipPhase relationshipPhase = db.RelationshipPhases.Find(id); db.RelationshipPhases.Remove(relationshipPhase); db.SaveChanges(); return(RedirectToAction("Details", "Relationships", new { id = relationshipPhase.RelationshipId })); }
public ActionResult Edit([Bind(Include = "ID,Relation,Closeness,ThoughtsOnCounterpart,Name")] RelationshipPhase relationshipPhase) { pc.RemovePage("Edit", "RelationshipPhases"); if (ModelState.IsValid) { db.Entry(relationshipPhase).State = EntityState.Modified; relationshipPhase.LastModified = DateTime.Now; db.SaveChanges(); return(RedirectToAction("Details", new { id = relationshipPhase.ID })); } return(RedirectToAction("Edit")); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RelationshipPhase relationshipPhase = db.RelationshipPhases.Find(id); if (relationshipPhase == null) { return(HttpNotFound()); } PageManager.CurrentRelationshipPhase = relationshipPhase; return(pc.AddDeletePage("RelationshipPhases", relationshipPhase, 4)); }
public ActionResult BindRelationshipPhaseToScene(int?id) { var scene = db.Scenes.Find(PageManager.CurrentScene.ID); RelationshipPhase relationChange = null; if (id != null) { relationChange = db.RelationshipPhases.Find(id); if (scene == null || relationChange == null) { return(HttpNotFound()); } scene.RelationshipChanges.Add(relationChange); relationChange.SceneId = scene.ID; db.SaveChanges(); } pc.RemovePage("PickMany", "RelationshipPhases"); var characters = db.Characters.Where(c => c.ProjectId == PageManager.CurrentProject.ID).ToList(); var relationshipPhases = new List <RelationshipPhase>(); characters.ForEach(c => { c.Relationships.ToList().ForEach(r => { r.Phases.ToList().ForEach(p => { if (p.SceneId == null) { relationshipPhases.Add(p); } }); }); }); if (relationshipPhases == null || !relationshipPhases.Any()) { return(RedirectToAction("Details", "Scenes", new { id = scene.ID })); } else { return(RedirectToAction("PickForRC")); } }
private void Initializing() { relationshipPhase = RelationshipPhase.Phase1; currentPlace = definition.OriginHome; isBirthday = false; relationship = 0; countChat = 0; countGift = 0; string placeID = ConvertType.GetPlaceId(currentPlace); if (placesController.PlacesDic != null) { if (placesController.PlacesDic.ContainsKey(placeID)) { placesController.PlacesDic[placeID].IsResidents(Id); placesController.PlacesDic[placeID].Arrived(arriver); } } }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RelationshipPhase relationshipPhase = db.RelationshipPhases.Find(id); if (relationshipPhase == null) { return(HttpNotFound()); } PageManager.CurrentRelationshipPhase = relationshipPhase; return(pc.AddEditPage("RelationshipPhases", relationshipPhase, 4, new List <int>() { 2, 1, 1, 3 })); }
public ActionResult Details(int?id) { RelationshipPhase relationshipPhase = null; if (id == null) { relationshipPhase = db.RelationshipPhases.Find(PageManager.CurrentRelationshipPhase.ID); } else { relationshipPhase = db.RelationshipPhases.Find(id); } if (relationshipPhase == null) { return(HttpNotFound()); } PageManager.CurrentRelationshipPhase = relationshipPhase; return(pc.AddDetailsPage("RelationshipPhases", relationshipPhase, 4)); }