public async Task <IActionResult> PutAssertive([FromRoute] int id, [FromBody] Assertive assertive) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != assertive.Id) { return(BadRequest()); } _context.Entry(assertive).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AssertiveExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostAssertive([FromBody] Assertive assertive) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Assertives.Add(assertive); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAssertive", new { id = assertive.Id }, assertive)); }
public void AssertiveTap(Assertive a) { Question q = ProfileData.Instance.Questions.ElementAt(Position); foreach (Assertive assertive in q.Assertives) { assertive.IsChecked = (a == assertive); } UpdateScores(); ScoreVisible = true; }
private void UpdateScores() { //questions ordened by Id that needs to be the same order of Features var qs = ProfileData.Instance.Questions.OrderBy(x => x.Id); float[] test = new float[ProfileData.Instance.Questions.Count()]; //get score value of each question based on the choiced assertive foreach (Question q in qs) { Assertive a = q.Assertives.Where(x => x.IsChecked == true).SingleOrDefault(); //as Id starts from 1 test[q.Id - 1] = a != null ? a.Score : -1; } float[] scores = knn.ClassifyRanked(test, 1); var ps = ProfileData.Instance.Profiles.OrderBy(x => x.Id); foreach (Profile p in ps) { //as Id starts from 1 p.Score = ScoreToPercentage(scores[p.Id - 1]); //p.Score = scores[p.Id]; } }
public void Execute(object parameter) { Assertive a = (Assertive)parameter; vm.AssertiveTap(a); }