This commit is contained in:
@@ -448,7 +448,7 @@ namespace AyaNova.Biz
|
||||
//Set linked objects
|
||||
if (o.BillHeadOffice)
|
||||
{
|
||||
if (j["HeadOfficeViz"] == null)
|
||||
if (JsonUtil.JTokenIsNullOrEmpty(j["HeadOfficeViz"]))
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "HeadOfficeViz");
|
||||
else
|
||||
{
|
||||
@@ -458,16 +458,16 @@ namespace AyaNova.Biz
|
||||
AddError(ApiErrorCode.NOT_FOUND, "HeadOfficeViz", $"'{(string)j["HeadOfficeViz"]}'");
|
||||
}
|
||||
}
|
||||
if (j["ContractViz"] != null)
|
||||
if (!JsonUtil.JTokenIsNullOrEmpty(j["ContractViz"]))
|
||||
{
|
||||
o.ContractId = await ct.Contract.AsNoTracking().Where(z => z.Name == (string)j["ContractViz"]).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
if (o.ContractId == 0)
|
||||
AddError(ApiErrorCode.NOT_FOUND, "ContractViz", $"'{(string)j["ContractViz"]}'");
|
||||
|
||||
if (j["ContractExpires"] != null)
|
||||
o.ContractExpires = (DateTime)j["ContractExpires"];
|
||||
else
|
||||
if (JsonUtil.JTokenIsNullOrEmpty(j["ContractExpires"]))
|
||||
o.ContractExpires = DateTime.UtcNow.Subtract(new TimeSpan(0, 1, 0));//expired one minute ago to be safe, can't guess what the contract should be
|
||||
else
|
||||
o.ContractExpires = (DateTime)j["ContractExpires"];
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user