This commit is contained in:
@@ -444,6 +444,34 @@ namespace AyaNova.Biz
|
|||||||
//import this record
|
//import this record
|
||||||
var o = j.ToObject<Customer>(jsset);
|
var o = j.ToObject<Customer>(jsset);
|
||||||
o.Tags.Add(ImportTag);
|
o.Tags.Add(ImportTag);
|
||||||
|
|
||||||
|
//Set linked objects
|
||||||
|
if (o.BillHeadOffice)
|
||||||
|
{
|
||||||
|
if (j["HeadOfficeVizNOTPRESETN"] == null)
|
||||||
|
AddError(ApiErrorCode.VALIDATION_REQUIRED, "HeadOfficeViz");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//if it's not found, it will be zero which will fail validation with a clean error
|
||||||
|
o.HeadOfficeId = await ct.HeadOffice.AsNoTracking().Where(z => z.Name == (string)j["HeadOfficeViz"]).Select(x => x.Id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
"BillHeadOffice",
|
||||||
|
"HeadOfficeName",
|
||||||
|
"HeadOfficeViz",
|
||||||
|
"TechNotes",
|
||||||
|
"AccountNumber",
|
||||||
|
"ContractName",
|
||||||
|
"ContractViz",
|
||||||
|
"ContractExpires",
|
||||||
|
*/
|
||||||
|
|
||||||
var res = await CreateAsync(o);
|
var res = await CreateAsync(o);
|
||||||
if (res == null)
|
if (res == null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user