I am currently doing a map-reduce with the c# driver in Mongo.
I have got it working where the JSON is as follows:
{ "_id" : CSUUID("ef53b163-699c-462f-9135-b81bad115635"), "value" : { "firstname" : "Joe", "lastname" : "Bloggs", "groupName" : "System Wide Access" } }
What I want to do is flatten this object so as I don't have an Id and Value field, I only want the actual properties that are in my read model class.
Here is my code as it is currently:
const string mapUserGroupMember = #"function ()
{
var output = {groupId:this.GroupId, firstname:this.Forename, lastname:this.Surname, groupName:null}
emit(this.GroupId, output);
}";
const string mapUserGroupName = #"function ()
{
var output = {groupId:this._id, firstname:null, lastname:null, groupName:this.Name}
emit(this._id, output);
}";
var reduceF = #"function(key, values) {
var results = {firstname:null, lastname:null , groupName:null};
values.forEach(function(v){
if(results.firstname ==null){
results.firstname = v.firstname
}
if(results.lastname ==null){
results.lastname = v.lastname
}
if(results.groupName ==null){
results.groupName = v.groupName
}
});
return results;
};";
var groupMemberCollection = database.GetCollection("UserGroupMemberReadModel");
var groupNameCollection = database.GetCollection("UserGroupNameReadModel");
var options = new MapReduceOptionsBuilder();
options.SetOutput(MapReduceOutput.Reduce("MergedData"));
var results = groupNameCollection.MapReduce(mapUserGroupName, reduceF, options);
results = groupMemberCollection.MapReduce(mapUserGroupMember, reduceF, options);
I want to be able to call var collection = database.GetCollection("MergedData").AsQueryable<ReadModel>();
Any help would be appreciated.
Related
I am onboarding alone on an existing project that do not have any unit test. My first goal before any refactoring is to cover 100% of the code. I would like to avoid any regression.
I have read how do I mock sqlconnection or should I refactor the code? but my case as you can see below is quite different cause I need to do more than stub simply the sqlConnection. Basically, I need to mock the db. I would like to know the best approach to achieve it.
(By the way, I do not want to use any ORM such as Entity).
Below the code of the repository :
public class HotelRepository : IHotelRepository
{
private readonly IDbConnection _dbConnection;
private readonly ILogService _loggerService;
public HotelRepository(IDbConnection dbConnection, ILogService loggerService)
{
_dbConnection = dbConnection;
_loggerService = loggerService;
}
public HotelDo GetByRid(string rid)
{
return Find(rid).FirstOrDefault();
}
public List<HotelDo> Find(string text)
{
try
{
_dbConnection.Open();
var items = new List<HotelDo>();
using (var command = _dbConnection.CreateCommand())
{
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "dbo.HotelSearchByRidOrName";
command.Parameters.Add(new SqlParameter("#Text", text));
using (var reader = command.ExecuteReader(CommandBehavior.CloseConnection))
{
while (reader.Read())
{
items.Add(new HotelDo()
{
Name = SqlExtension.ReaderToStringConverter(reader["Name"]),
Id = SqlExtension.ReaderToIntConverter(reader["Id"]),
Rid = SqlExtension.ReaderToStringConverter(reader["RIDHotel"]),
IdPms = SqlExtension.ReaderToNullableIntConverter(reader["IdPms"]),
LinkResaWeb = SqlExtension.ReaderToStringConverter(reader["LinkResaWeb"]),
LinkPms = SqlExtension.ReaderToStringConverter(reader["LinkPms"]),
IdBrand = SqlExtension.ReaderToNullableIntConverter(reader["IdBrand"]) ?? 0,
IsOnline = SqlExtension.ReaderToBoolConverter(reader["IsOnline"]) ?? false,
CodeCountry = SqlExtension.ReaderToStringConverter(reader["CodeCountry"])
});
}
}
}
return items;
}
catch (Exception e)
{
var errorMessage = $"HotelRepository Find, text {text} ";
_loggerService.Trace(LogSeverity.Error, errorMessage, e);
throw new DalException() { Source = errorMessage, };
}
finally
{
_dbConnection.Close();
}
}
public List<HotelDo> GetAll()
{
try
{
_dbConnection.Open();
var items = new List<HotelDo>();
using (var command = _dbConnection.CreateCommand())
{
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "dbo.HotelGetAll";
using (var reader = command.ExecuteReader(CommandBehavior.CloseConnection))
{
while (reader.Read())
{
bool.TryParse(reader["IsOnline"].ToString(), out var isOnline);
items.Add(new HotelDo()
{
Id = SqlExtension.ReaderToIntConverter(reader["Id"]),
Rid = SqlExtension.ReaderToStringConverter(reader["RIDHotel"]),
Name = SqlExtension.ReaderToStringConverter(reader["Name"]),
CodeCountry = SqlExtension.ReaderToStringConverter(reader["CodeCountry"]),
LinkPms = SqlExtension.ReaderToStringConverter(reader["LinkPms"]),
IdPms = SqlExtension.ReaderToNullableIntConverter(reader["IdPms"]),
IdBrand = SqlExtension.ReaderToNullableIntConverter(reader["IdBrand"]) ?? 0,
LinkResaWeb = SqlExtension.ReaderToStringConverter(reader["LinkResaWeb"]),
IsOnline = isOnline
});
}
}
}
return items;
}
catch (Exception e)
{
var errorMessage = $"HotelRepository GetAllHotels";
_loggerService.Trace(LogSeverity.Error, errorMessage, e);
throw new DalException() { Source = errorMessage, };
}
finally
{
_dbConnection.Close();
}
}
}
Thank you for your help
So based on what you've got I've set up a test frame for you to follow. I've removed less important components for breviety.
Before you you jump in I just want to give my 2 cents, if you don't know how to do this sort of thing you seem to be more or less in a junior position or less experiance with C# and also found your self in a more or less mature company that doesn't care about the development deparment, since an uncovered project just get's thrown your way says you don't have alot of resources to go about to imrpove the code base.
Test only the things that have business value (can you put a price on the piece of logic if it brakes)
Delivering stuff faster will make you look better as a programmer (noone in the business gives a damn about test covarage)
Study hard, get your experiance, good reputation and don't be afraid to get the hell out of there as soon as you start getting bored.
Main
void Main()
{
var idIndex = 0;
var ids = new string[] { "1", "2" };
var mockDataReader = new Mock<IDataReader>();
mockDataReader.SetupSequence(x => x.Read()).Returns(true).Returns(true).Returns(false);
mockDataReader.SetupGet(x => x["Id"]).Returns(() => ids[idIndex]).Callback(() => idIndex++);
var mockParameters = new Mock<IDataParameterCollection>();
var mockCommand = new Mock<IDbCommand>();
mockCommand.SetupGet(x => x.Parameters).Returns(mockParameters.Object);
mockCommand.Setup(x => x.ExecuteReader(CommandBehavior.CloseConnection)).Returns(mockDataReader.Object);
var mockConnection = new Mock<IDbConnection>();
mockConnection.Setup(x => x.CreateCommand()).Returns(mockCommand.Object);
var repo = new HotelRepository(mockConnection.Object);
var result = repo.Find("search");
Assert.Equal("1", result[0].Id);
Assert.Equal("2", result[1].Id);
}
Repository
public class HotelRepository
{
private readonly IDbConnection _dbConnection;
public HotelRepository(IDbConnection dbConnection)
{
_dbConnection = dbConnection;
}
public List<Pony> Find(string text)
{
_dbConnection.Open();
var items = new List<Pony>();
using (var command = _dbConnection.CreateCommand())
{
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "dbo.HotelSearchByRidOrName";
command.Parameters.Add(new SqlParameter("#Text", text));
using (var reader = command.ExecuteReader(CommandBehavior.CloseConnection))
{
while (reader.Read())
{
items.Add(new Pony
{
Id = reader["Id"].ToString()
});
}
}
}
return items;
}
}
Just a dumb o'l pony
public class Pony {
public string Id { get; set; }
}
I am trying to get some CloudWatch metrics using .NET SDK. The code that is seen below returns some data points but after returning about 20 data points it raises an Exception of InvalidNextToken.
private static void Main(string[] args)
{
Console.Clear();
var creds = new StoredProfileAWSCredentials();
var c = new AmazonCloudWatchClient(creds, RegionEndpoint.EUCentral1);
Task<GetMetricDataResponse> t = null;
string nextToken = null;
do
{
var req = new GetMetricDataRequest
{
EndTimeUtc = DateTime.UtcNow,
MaxDatapoints = 10,
StartTimeUtc = DateTime.UtcNow.AddHours(-1),
ScanBy = new ScanBy("TimestampDescending"),
NextToken = nextToken,
MetricDataQueries = new List<MetricDataQuery>
{
new MetricDataQuery
{
Id = "a" + Guid.NewGuid().ToString().Replace("-", ""),
MetricStat = new MetricStat
{
Stat = "Maximum",
Metric = new Metric
{
MetricName = "CPUUtilization",
Dimensions = new List<Dimension>
{
new Dimension
{
Name = "InstanceId",
Value = "i-04f27d16c91c70119"
}
},
Namespace = "AWS/EC2"
},
Period = 60,
Unit = StandardUnit.Percent
}
}
}
};
t = c.GetMetricDataAsync(req);
t.Wait();
var usage = t.Result;
if (usage.MetricDataResults.Any())
foreach (var r in usage.MetricDataResults)
foreach (var rValue in r.Values)
Console.WriteLine(Math.Round(rValue * 100));
nextToken = t.Result.NextToken;
} while (!string.IsNullOrEmpty(nextToken));
Console.ReadKey();
}
The exact Exception message is:
InvalidNextTokenException: The service returned an error with Error
Code InvalidNextToken and HTTP Body:
Sender
InvalidNextToken 795050a1-3bcd-4a44-9794-5becd0c4f5cf
For nextToken to work, you need to send the exact same request, with only the token changing between calls.
You have id, StartTimeUtc and EndTimeUtc changing between requests.
Initializing them before the loop should fix your problem.
Try something like this:
private static void Main(string[] args)
{
Console.Clear();
var creds = new StoredProfileAWSCredentials();
var c = new AmazonCloudWatchClient(creds, RegionEndpoint.EUCentral1);
Task<GetMetricDataResponse> t = null;
string nextToken = null;
var endTime = DateTime.UtcNow;
var startTime = endTime.AddHours(-1);
var id = "a" + Guid.NewGuid().ToString().Replace("-", "");
do
{
var req = new GetMetricDataRequest
{
EndTimeUtc = endTime,
MaxDatapoints = 10,
StartTimeUtc = startTime,
ScanBy = new ScanBy("TimestampDescending"),
NextToken = nextToken,
MetricDataQueries = new List<MetricDataQuery>
{
new MetricDataQuery
{
Id = id,
MetricStat = new MetricStat
{
Stat = "Maximum",
Metric = new Metric
{
MetricName = "CPUUtilization",
Dimensions = new List<Dimension>
{
new Dimension
{
Name = "InstanceId",
Value = "i-04f27d16c91c70119"
}
},
Namespace = "AWS/EC2"
},
Period = 60,
Unit = StandardUnit.Percent
}
}
}
};
t = c.GetMetricDataAsync(req);
t.Wait();
var usage = t.Result;
if (usage.MetricDataResults.Any())
foreach (var r in usage.MetricDataResults)
foreach (var rValue in r.Values)
Console.WriteLine(Math.Round(rValue * 100));
nextToken = t.Result.NextToken;
} while (!string.IsNullOrEmpty(nextToken));
Console.ReadKey();
}
I am new to .netcore mvc architecture. I am trying to consume the api data response, So far I have successfully fetched the data, but the problem I am facing is when the api response/result is more than one. Forexample if the actuall api response is the following
"responseHeader":{
"status":0,
"QTime":0,
"params":{
"q":"title:\"A\""}},
"response":{"numFound":3,"start":0,"docs":[
{
"date":"1970-01-01T00:00:00Z",
"tstamp":"2019-11-22T12:22:31.698Z",
"digest":"e23d679991d80d832504e7395d139fe4",
"contentLength":"25476",
"boost":0.0,
"title":["emb- A1]
"url":"https://www.example.com/a/b/c0/"},
{
"date":"1970-01-01T00:00:00Z",
"tstamp":"2019-11-22T12:22:31.698Z",
"digest":"e23d679991d80d832504e7395d139fe4",
"contentLength":"25476",
"boost":0.0,
"title":["emb - A2]
"url":"https://www.example.com/a/b/c1/"
},
{
"date":"1970-01-01T00:00:00Z",
"tstamp":"2019-11-22T12:22:31.698Z",
"digest":"e23d679991d80d832504e7395d139fe4",
"contentLength":"25476",
"boost":0.0,
"title":["emb - A3]
"url":"https://www.example.com/a/b/c2/"
}
I am only getting
{"title":"[\r\n \"emb- A1","source":"https://www.example.com/a/b/c0/"}
instead of having all the response data.
My Code is below.
Model
SearchModel.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace searchEngineTesting.Models
{
public class SearchModel
{
public string Title;
public string Source;
}
}
Controller
EngineController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using searchEngineTesting.Models;
namespace searchEngineTesting.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class EngineController : ControllerBase {
[HttpGet("[action]/{query}")]
public async Task<IActionResult> Product(string query)
{
var model = new SearchModel();
using (var client = new HttpClient())
{
try
{
client.BaseAddress = new Uri("http://xx.xx.xxx.xx:8080");
var response = await client.GetAsync($"/abc/xxx/select?q=title%3A%22{query}%22");
response.EnsureSuccessStatusCode();
var stringResult = await response.Content.ReadAsStringAsync();
var root = (JObject)JsonConvert.DeserializeObject(stringResult);
//var details = JsonConvert.DeserializeObject<SearchModel>(stringResult);
var items = root.SelectToken("").Children().OfType<JProperty>().ToDictionary(p => p.Name, p => p.Value);
foreach (var item in items)
{
if (item.Key == "response")
{
var key = item.Value.SelectToken("").OfType<JProperty>().ToDictionary(p => p.Name, p => p.Value);
foreach (var k in key)
{
if(k.Key == "docs")
{
var tests = JsonConvert.DeserializeObject<JArray>(k.Value.ToString());
var data = k.Value.SelectToken("").Children().First();
var test = data.SelectToken("").Children().OfType<JProperty>().ToDictionary(p => p.Name, p => p.Value).ToList();
foreach (var t in test)
{
if (t.Key =="url")
{
model.Source = t.Value.ToString();
}
else if (t.Key == "title")
{
model.Title = t.Value.ToString(); }
}
}
}
}
}
return new JsonResult(model);
}
catch (InvalidOperationException httpreq) {
return BadRequest("Sorry: There are no results for your query");
}
}
}
}
}
How can I retrieve whole of the response I am getting from actual API.
Please help..!
How can I retrieve whole of the response I am getting from actual API.
If you want to return all the actual api response,then just use below code:
[HttpGet("[action]/{query}")]
public async Task<IActionResult> Product(string query)
{
var model = new SearchModel();
using (var client = new HttpClient())
{
try
{
client.BaseAddress = new Uri("http://xx.xx.xxx.xx:8080");
var response = await client.GetAsync($"/abc/xxx/select?q=title%3A%22{query}%22");
response.EnsureSuccessStatusCode();
var stringResult = await response.Content.ReadAsStringAsync();
var root = (JObject)JsonConvert.DeserializeObject(stringResult);
return new JsonResult(root);
}
catch (InvalidOperationException httpreq)
{
}
}
return Ok()
}
If you would like to just return List<SearchModel> from the actual response,you should not use var data = k.Value.SelectToken("").Children().First(); which will only retrieve the first element of docs array.
Try to foreach k.Value.SelectToken("").Children() and return List<SearchModel> instead of a SearchModel,refer to
[HttpGet("[action]/{query}")]
public async Task<IActionResult> Product(string query)
{
//initialize a list SearchModel
var modelList = new List<SearchModel>();
using (var client = new HttpClient())
{
try
{
client.BaseAddress = new Uri("http://xx.xx.xxx.xx:8080");
var response = await client.GetAsync($"/abc/xxx/select?q=title%3A%22{query}%22");
response.EnsureSuccessStatusCode();
var stringResult = await response.Content.ReadAsStringAsync();
var root = (JObject)JsonConvert.DeserializeObject(stringResult);
var items = root.SelectToken("").Children().OfType<JProperty>().ToDictionary(p => p.Name, p => p.Value);
foreach (var item in items)
{
if (item.Key == "response")
{
var key = item.Value.SelectToken("").OfType<JProperty>().ToDictionary(p => p.Name, p => p.Value);
foreach (var k in key)
{
if (k.Key == "docs")
{
//remove .First()
var arrayData = k.Value.SelectToken("").Children();
foreach(var data in arrayData)
{
var model = new SearchModel();
var test = data.SelectToken("").Children().OfType<JProperty>().ToDictionary(p => p.Name, p => p.Value).ToList();
foreach (var t in test)
{
if (t.Key == "url")
{
model.Source = t.Value.ToString();
}
else if (t.Key == "title")
{
model.Title = t.Value.ToString();
}
}
modelList.Add(model);
}
}
}
}
}
return new JsonResult(modelList);
}
catch (InvalidOperationException httpreq)
{
}
}
return Ok();
}
Your model is not a list, but only a single object which you would overwrite continuously in your loop so that only one element remains.
Then you will need to iterate over all docs, not just use the first (e.g. k.Value.SelectToken("").Children().First()).
So you should be able to resolve your issue by changing your model to a List of SearchModels, and ensuring to iterate through all documents (it helps to inspect the variables in a debugger to see what happens).
An easier approach would be using JsonConvert, where you just would need to mirror the relevant structure of the JSON using C# classes, e.g.:
public class Document
{
public string Title;
public string Url;
}
public class Result
{
public Response response;
}
public class Response
{
public List<Document> docs;
}
then deserialize the json simple as:
var result = JsonConvert.DeserializeObject<Result>(stringResult);
and finally converting the result to your SearchModel:
var searchModels = result.response.docs.Select(x => new SearchModel {Source = x.Url, Title = x.Title}).ToList();
I have two questions here
Is it possible to add dynamic lists values to field injection list input ?
Can I create a trigger for this so this can be initiated from any other input selection say a class selection will populate all fields
I was just looking into FieldInjection.js whether that can be extented for the same
Can someone please provide a hint or direction for this ?
Thanks.
For anyone interested in the answer, I was able to achieve the above goal by changing the set function of the Java Class select input as folllowing
few imports
var extensionElementsHelper = require('../../../../helper/ExtensionElementsHelper'),
elementHelper = require('../../../../helper/ElementHelper')
var CAMUNDA_FIELD_EXTENSION_ELEMENT = 'camunda:Field';
function getExtensionFields(bo) {
return bo && extensionElementsHelper.getExtensionElements(bo, CAMUNDA_FIELD_EXTENSION_ELEMENT) || [];
}
then changing the set function to create extension element and push the field values as :
set: function(element, values, node) {
var bo = getBusinessObject(element);
var type = getImplementationType(element);
var attr = getAttribute(type);
var prop = {}
var commands = [];
prop[attr] = values.delegate || '';
var extensionElements = getExtensionFields(bo);
//remove any extension elements existing before
extensionElements.forEach(function(ele){
commands.push(extensionElementsHelper.removeEntry(getBusinessObject(element), element, ele));
});
if(prop[attr] !== ""){
var extensionElements = elementHelper.createElement('bpmn:ExtensionElements', { values: [] }, bo, bpmnFactory);
commands.push(cmdHelper.updateBusinessObject(element, bo, { extensionElements: extensionElements }));
var arrProperties = ["private org.camunda.bpm.engine.delegate.Expression com.cfe.extensions.SampleJavaDelegate.varOne","private org.camunda.bpm.engine.delegate.Expression com.cfe.extensions.SampleJavaDelegate.varTwo"]
var newFieldElem = "";
arrProperties.forEach(function(prop){
var eachProp = {
name:"",
string:"",
expression:""
}
var type = prop.split(" ")[1].split(".").reverse()[0];
var val = prop.split(" ")[2].split(".").reverse()[0];
eachProp.name = val;
if( type == "String"){
eachProp.string = "${" + val +" }"
}else if( type == "Expression"){
eachProp.expression = "${" + val +" }"
}
newFieldElem = elementHelper.createElement(CAMUNDA_FIELD_EXTENSION_ELEMENT, eachProp, extensionElements, bpmnFactory);
commands.push(cmdHelper.addElementsTolist(element, extensionElements, 'values', [ newFieldElem ]));
});
}
commands.push(cmdHelper.updateBusinessObject(element, bo, prop));
return commands;
}
Cheers !.
I am new to emberjs and making one simple CRUD application. I am using ember data and localstorage-adapter to save record in local storage of browser.
I am trying to update record using localstorage-adapter but it is throwing error.
I have listed my code here :
updatecontact: function(){//save data in local storage
var fname = this.obj_form_edit_data.get('cont_data.fname');
var lname = this.get('cont_data.lname');
var email = this.get('cont_data.email');
var contactno = this.get('cont_data.contactno');
var gendertype = ((this.get('isMale') == true) ? true : false);
var contactype = $(".selectpicker").val();
Grid.ModalModel.updateRecords({
fname: fname,
lname: lname,
email: email,
contactno: contactno,
gendertype: gendertype,
contactype: contactype
});
this.get('store').commit();
}
I am getting following error using above code :
Uncaught TypeError: Object function () {
if (!wasApplied) {
Class.proto(); // prepare prototype...
}
o_defineProperty(this, GUID_KEY, undefinedDescriptor);
o_defineProperty(this, '_super', undefinedDescriptor);
var m = meta(this);
m.proto = this;
if (initMixins) {
// capture locally so we can clear the closed over variable
var mixins = initMixins;
initMixins = null;
this.reopen.apply(this, mixins);
}
if (initProperties) {
// capture locally so we can clear the closed over variable
var props = initProperties;
initProperties = null;
var concatenatedProperties = this.concatenatedProperties;
for (var i = 0, l = props.length; i < l; i++) {
var properties = props[i];
Ember.assert("Ember.Object.create no longer supports mixing in other definitions, use createWithMixins instead.", !(properties instanceof Ember.Mixin));
for (var keyName in properties) {
if (!properties.hasOwnProperty(keyName)) { continue; }
var value = properties[keyName],
IS_BINDING = Ember.IS_BINDING;
if (IS_BINDING.test(keyName)) {
var bindings = m.bindings;
if (!bindings) {
bindings = m.bindings = {};
} else if (!m.hasOwnProperty('bindings')) {
bindings = m.bindings = o_create(m.bindings);
}
bindings[keyName] = value;
}
var desc = m.descs[keyName];
Ember.assert("Ember.Object.create no longer supports defining computed properties.", !(value instanceof Ember.ComputedProperty));
Ember.assert("Ember.Object.create no longer supports defining methods that call _super.", !(typeof value === 'function' && value.toString().indexOf('._super') !== -1));
if (concatenatedProperties && indexOf(concatenatedProperties, keyName) >= 0) {
var baseValue = this[keyName];
if (baseValue) {
if ('function' === typeof baseValue.concat) {
value = baseValue.concat(value);
} else {
value = Ember.makeArray(baseValue).concat(value);
}
} else {
value = Ember.makeArray(value);
}
}
if (desc) {
desc.set(this, keyName, value);
} else {
if (typeof this.setUnknownProperty === 'function' && !(keyName in this)) {
this.setUnknownProperty(keyName, value);
} else if (MANDATORY_SETTER) {
Ember.defineProperty(this, keyName, null, value); // setup mandatory setter
} else {
this[keyName] = value;
}
}
}
}
}
finishPartial(this, m);
delete m.proto;
finishChains(this);
this.init.apply(this, arguments);
} has no method 'updateRecords'
I am using following code to create new record which working fine :
savecontact: function(){//save data in local storage
var fname = this.obj_form_edit_data.get('cont_data.fname');
var lname = this.obj_form_edit_data.get('cont_data.lname');
var email = this.obj_form_edit_data.get('cont_data.email');
var contactno = this.obj_form_edit_data.get('cont_data.contactno');
var gendertype = ((this.get('isMale') == true) ? true : false);
var contactype = $(".selectpicker").text();
Grid.ModalModel.createRecord({
fname: fname,
lname: lname,
email: email,
contactno: contactno,
gendertype: gendertype,
contactype: contactype
});
this.get('store').commit();
}
You're using updateRecords as a plural, it should be updateRecord