public async Task <IActionResult> PostContextAsync([FromBody] Models.Classification model) { try { if (await context.Classifications.AsNoTracking().AnyAsync(o => o.Code.Equals(model.Code) && o.Index.Equals(model.Index))) { if (context.Classifications.AsNoTracking().Single(o => o.Code.Equals(model.Code) && o.Index.Equals(model.Index)).Title.Equals(model.Title)) { return(NoContent()); } else { context.Classifications.Find(model.Code, model.Index).Title = model.Title; } } else { context.Classifications.Add(model); } return(Ok(context.SaveChanges())); } catch (Exception ex) { Console.WriteLine($"{GetType()}\n{ex.Message}\n{nameof(this.PostContextAsync)}"); } return(BadRequest()); }
public void UpdateClassification(Models.Classification classification) { ExecuteProcedure( "UpdateClassification", new string[] { "@ClassificationId", "@Type", "@Base" }, new object[] { classification.Id, classification.Type, classification.Base } ); }
public EditViewModel(Models.Classification classification) { ClassificationID = classification.ClassificationID; DisplayName = classification.DisplayName; ClassificationDescription = classification.ClassificationDescription; GoalStatement = classification.GoalStatement; ThemeColor = classification.ThemeColor; }
private void SelectClassification(int classificationId) { _classification = Models.Classification .CreateClassification(_sqlClient.FindClassification(classificationId)); ClassificationTypeComboBox.Text = _classification.Type; ConceptsRootTextBox.Text = GetConceptName(_classification.ConceptRootId); ClassificationBaseTextBox.Text = _classification.Base; }
public void UpdateModel(Models.Classification classification, Person currentPerson) { classification.DisplayName = DisplayName; classification.ClassificationDescription = ClassificationDescription; classification.GoalStatement = GoalStatement; if (KeyImageFileResourceData != null) { classification.KeyImageFileResource = FileResource.CreateNewFromHttpPostedFileAndSave(KeyImageFileResourceData, currentPerson); } classification.ThemeColor = ThemeColor; }
public DetailViewData(Person currentPerson, Models.Classification classification) : base(currentPerson) { Classification = classification; PageTitle = classification.ClassificationSystem.ClassificationSystemNamePluralized; EditClassificationUrl = SitkaRoute <ClassificationController> .BuildUrlFromExpression(c => c.Edit(classification)); IndexUrl = SitkaRoute <ProgramInfoController> .BuildUrlFromExpression(c => c.ClassificationSystem(classification.ClassificationSystem)); UserHasClassificationManagePermissions = new PerformanceMeasureManageFeature().HasPermissionByPerson(currentPerson); ClassificationDisplayNamePluralized = classification.ClassificationSystem.ClassificationSystemNamePluralized; ClassificationDisplayName = classification.ClassificationSystem.ClassificationSystemName; BasicProjectInfoGridName = "geospatialAreaProjectListGrid"; BasicProjectInfoGridSpec = new BasicProjectInfoGridSpec(CurrentPerson, false) { ObjectNameSingular = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} associated with the {ClassificationDisplayName} {classification.DisplayName}", ObjectNamePlural = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()} associated with the {ClassificationDisplayName} {classification.DisplayName}", SaveFiltersInCookie = true }; BasicProjectInfoGridDataUrl = SitkaRoute <ClassificationController> .BuildUrlFromExpression(tc => tc.ProjectsGridJsonData(classification)); }
public void Update(UpdateClassificationInput input) { Models.Classification output = Mapper.Map <UpdateClassificationInput, Models.Classification>(input); _ClassificationManager.Update(output); }
public async Task Create(CreateClassificationInput input) { Models.Classification output = Mapper.Map <CreateClassificationInput, Models.Classification>(input); await _ClassificationManager.Create(output); }