public ActionResult PerformCreateAndAddRelation(long relationTypeId, long entityId, FormCollection formCollection) { TEntity entity = Model.GetEntity(entityId); if (entity == null || !entity.IsEditable) { return(RedirectToAction("Index")); } // TODO better check of relationTypeId validity. RelationModel relationModel = RemoteFacade.Instance.GetModel <RelationModel> (db); TypedRelations relations = relationModel.GetRelations(relationTypeId, entity); if (relations == null) { return(RedirectToAction("Index")); } Entity newEntity = relationModel.GetNewObjectiveEntity(relations.RelationType, String.Empty); TryUpdateModel(relations.RelationType.ObjectiveEntityType, newEntity, "NewEntity"); if (ModelState.IsValid) { newEntity = RemoteFacade.Instance.GetEntityModel(newEntity.GetType(), db).AddNewEntity(newEntity); relationModel.AddRelation(relationTypeId, entity, newEntity.Id); return(RedirectToAction("Relations", new { RelationTypeId = relationTypeId, EntityId = entityId })); } return(View(CreateAndAddRelationView, new CreateAndAddRelationViewModel() { Entity = entity, RelationTypeId = relationTypeId, NewEntity = (Entity)newEntity })); }
public FileSystemIndexConfigurator(string directory, Model model, string name) { _directory = directory; _model = model; _entityMap = model.GetEntity(name); _indexes = new IndexConfigurationConverter(model, _entityMap).Convert(); }
public ActionResult Edit(long id, FormCollection formCollection) { TEntity entity = Model.GetEntity(id); if (entity == null || !entity.IsEditable) { return(RedirectToAction("Index")); } // The identification of the entity has to be remembered because some of the fields, that involve the identification // could been filled invalidly. That would cause that invalid identifaction of the entity is displayed. string validIdentification = entity.Identification; TryUpdateModel(entity, "Entity"); if (ModelState.IsValid) { Model.SaveEntity(entity); return(RedirectToDetail(entity)); } return(View(EditView, new EntityEditViewModel() { Entity = entity, Identification = validIdentification })); }
public void ProcessEvent(Model model, Dictionary ev) { if ((string)ev["action"] == "Move" && !movePrompt) { movePrompt = true; model.CoolerApiEvent(-1, "Print", "Use the numpad to move. Hold Ctrl to move 5 spaces."); model.CoolerApiEvent(-1, "Print", "Or, click to path somewhere. (Use arrow keys if you must.)"); } if ((string)ev["action"] == "Downed") { Entity subject = model.GetEntity((int)ev["subject"]); if (subject.team != 0 && !abilitiesPrompt) { abilitiesPrompt = true; model.CoolerApiEvent(-1, "Print", "Press A for [A]bilities!"); } if (subject.id == 0) { DumpStats(model); } } if ((string)ev["action"] == "Exit") { DumpStats(model); } }
public ActionResult CreateAndAddRelation(long relationTypeId, long entityId, string relatedEntityId) { TEntity entity = Model.GetEntity(entityId); if (entity == null || !entity.IsEditable) { return(RedirectToAction("Index")); } // TODO better check of relationTypeId validity. RelationModel relationModel = RemoteFacade.Instance.GetModel <RelationModel> (db); TypedRelations relations = relationModel.GetRelations(relationTypeId, entity); if (relations == null) { return(RedirectToAction("Index")); } return(View(CreateAndAddRelationView, new CreateAndAddRelationViewModel() { Entity = entity, RelationTypeId = relationTypeId, NewEntity = relationModel.GetNewObjectiveEntity(relations.RelationType, relatedEntityId) })); }
void OnSave(object sender, EventArgs e) { var repository = new PropertyRepository(); repository.SaveOrUpdate(Model.GetEntity()); Navigation.PopAsync(); }
public ActionResult AddRelation(long relationTypeId, long entityId, long relatedEntityId) { TEntity entity = Model.GetEntity(entityId); if (entity != null) { RemoteFacade.Instance.GetModel <RelationModel> (db).AddRelation(relationTypeId, entity, relatedEntityId); } return(RedirectToAction("Relations", new { RelationTypeId = relationTypeId, EntityId = entityId })); }
public ActionResult DeleteRelation(long relationTypeId, long entityId, long relationId) { TEntity entity = Model.GetEntity(entityId); if (entity != null && entity.IsEditable) { RemoteFacade.Instance.GetModel <RelationModel> (db).DeleteRelation(relationTypeId, entity, relationId); } return(RedirectToAction("Relations", new { RelationTypeId = relationTypeId, EntityId = entityId })); }
public ActionResult Publications(long id) { TEntity informativeEntity = Model.GetEntity(id); if (informativeEntity == null) { return(RedirectToAction("Index")); } return(View("Entity/InformativeEntity/Publications", informativeEntity)); }
public ActionResult Close(long id) { Incident incidentToClose = Model.GetEntity(id); if (incidentToClose == null || !incidentToClose.IsEditable) { return(RedirectToAction("Index")); } return(View(incidentToClose)); }
public ActionResult Close(long id) { Report report = Model.GetEntity(id); if (report == null) { return(RedirectToAction("Index")); } Model.CloseReport(report); return(RedirectToDetail(report)); }
public void ProcessEvent(Model model, Dictionary ev) { if ((string)ev["action"] == "Move") { Entity subject = model.GetEntity((int)ev["subject"]); if (subject.team == 0) { UpdateVision(model, subject); subject.dirtyVision = false; } } }
public ActionResult Open(long id) { Incident incidentToOpen = Model.GetEntity(id); if (incidentToOpen == null) { return(RedirectToAction("Index")); } Model.OpenIncident(incidentToOpen); return(RedirectToDetail(incidentToOpen)); }
public ActionResult Close(long id, FormCollection formCollection) { Incident incidentToClose = Model.GetEntity(id); if (incidentToClose == null || !incidentToClose.IsEditable) { return(RedirectToAction("Index")); } TryUpdateModel(incidentToClose); Model.CloseIncident(incidentToClose); return(RedirectToDetail(incidentToClose)); }
public JsonResult SearchForRelatableEntities(long relationTypeId, long entityId, string needle) { TEntity entity = Model.GetEntity(entityId); if (entity != null) { return(new JsonResult() { Data = SerializeEntities(RemoteFacade.Instance.GetModel <RelationModel> (db).GetRelatableEntities( relationTypeId, entity, needle)) }); } return(new JsonResult()); }
public ActionResult Delete(long id) { TEntity entity = Model.GetEntity(id); if (entity == null) { return(RedirectToAction("Index")); } return(View(DeleteView, new EntityViewModel() { Entity = entity })); }
public ActionResult Edit(long id) { TEntity entity = Model.GetEntity(id); if (entity == null || !entity.IsEditable) { return(RedirectToAction("Index")); } return(View(EditView, new EntityEditViewModel() { Entity = entity, Identification = entity.Identification })); }
public void ProcessEvent(Model model, Dictionary ev) { if ((string)ev["action"] == "Downed") { Entity subject = model.GetEntity((int)ev["subject"]); if (subject.team != 0) { kills++; } else if (subject.id != 0) { partnerDead = true; } } if ((string)ev["action"] == "Hit" || (string)ev["action"] == "Rush") { Entity subject = model.GetEntity((int)ev["subject"]); if (subject.id == 0) { playerDamage += (int)(ev["damage"]); // ew } if (subject.id == 1) { partnerDamage += (int)(ev["damage"]); } } if ((string)ev["action"] == "Print") { if ((string)ev["args"] == "Got the moss.") { gotMoss = true; } } }
public ActionResult Publish(long id) { TEntity informativeEntity = Model.GetEntity(id); if (informativeEntity == null || !informativeEntity.IsPublishable) { return(RedirectToAction("Index")); } return(View("Entity/InformativeEntity/Publish", new InformativeEntityPublicationViewModel() { Entity = informativeEntity, Publication = new Publication() })); }
public ActionResult Detail(long id) { TEntity entity = Model.GetEntity(id); if (entity == null) { return(RedirectToAction("Index")); } return(View(DetailView, new EntityDetailViewModel() { Entity = entity, Relations = RemoteFacade.Instance.GetModel <RelationModel> (db).GetRelations(entity) })); }
public ActionResult Relations(long relationTypeId, long entityId) { TEntity entity = Model.GetEntity(entityId); if (entity == null) { return(RedirectToAction("Index")); } TypedRelations relations = RemoteFacade.Instance.GetModel <RelationModel> (db).GetRelations(relationTypeId, entity); if (relations == null) { return(RedirectToAction("Index")); } return(View(RelationsView, new EntityRelationsViewModel() { Entity = entity, Relations = relations })); }
public ActionResult Publish(long id, FormCollection formCollection) { TEntity informativeEntity = Model.GetEntity(id); if (informativeEntity == null || !informativeEntity.IsPublishable) { return(RedirectToAction("Index")); } Publication publication = new Publication(); TryUpdateModel(publication, "Publication"); if (ModelState.IsValid) { Model.Publish(informativeEntity, publication); return(RedirectToAction("Publications", new { Id = informativeEntity.Id })); } return(View("Entity/InformativeEntity/Publish", new InformativeEntityPublicationViewModel() { Entity = informativeEntity, Publication = publication })); }
public MemoryIndexConfigurator(Model model, string name) { _model = model; _entityMap = model.GetEntity(name); _indexes = new IndexConfigurationConverter(model, _entityMap).Convert(); }