public IActionResult AddPSKIdentity() { IActionResult result = null; string rootUrl = Request.GetRootUrl(); Model.PSKIdentity item = new Model.PSKIdentity(); item.OrganisationID = User.GetOrganisationID(); BusinessLogicFactory.Identities.SavePSKIdentity(item, Model.TObjectState.Add); ServiceModels.PSKIdentity response = new ServiceModels.PSKIdentity(item); response.Secret = item.Secret; response.AddSelfLink(string.Concat(rootUrl, "/identities/psk/", response.Identity), false, true); result = Request.GetObjectResult(response, System.Net.HttpStatusCode.Created); return result; }
public IActionResult AddPSKIdentity() { IActionResult result = null; string rootUrl = Request.GetRootUrl(); Model.PSKIdentity item = new Model.PSKIdentity(); item.OrganisationID = User.GetOrganisationID(); BusinessLogicFactory.Identities.SavePSKIdentity(item, Model.TObjectState.Add); ServiceModels.PSKIdentity response = new ServiceModels.PSKIdentity(item); response.Secret = item.Secret; response.AddSelfLink(string.Concat(rootUrl, "/identities/psk/", response.Identity), false, true); result = Request.GetObjectResult(response, System.Net.HttpStatusCode.Created); return(result); }
public IActionResult GetPSKIdentity(string identity) { IActionResult result; Model.PSKIdentity pskIdentity = BusinessLogicFactory.Identities.GetPSKIdentity(identity); if (pskIdentity == null) { result = new NotFoundResult(); } else { ServiceModels.PSKIdentity response = new ServiceModels.PSKIdentity(pskIdentity); string rootUrl = Request.GetRootUrl(); response.AddSelfLink(string.Concat(rootUrl, "/identities/psk/", response.Identity), false, true); result = Request.GetObjectResult(response); } return(result); }
public IActionResult GetPSKIdentities() { IActionResult result = null; string rootUrl = Request.GetRootUrl(); PSKIdentities response = new PSKIdentities(); response.AddLink("add", string.Concat(rootUrl, "/identities/psk"), null); int organisationID = User.GetOrganisationID(); List <Model.PSKIdentity> pskIdentities = BusinessLogicFactory.Identities.GetPSKIdentities(organisationID); response.PageInfo = Request.GetPageInfo(pskIdentities.Count); int endIndex = response.PageInfo.StartIndex + response.PageInfo.ItemsCount; for (int index = response.PageInfo.StartIndex; index < endIndex; index++) { ServiceModels.PSKIdentity pskIdentity = new ServiceModels.PSKIdentity(pskIdentities[index]); pskIdentity.AddSelfLink(string.Concat(rootUrl, "/identities/psk/", pskIdentity.Identity), false, true); response.Add(pskIdentity); } result = Request.GetObjectResult(response); return(result); }
public IActionResult GetPSKIdentity(string identity) { IActionResult result; Model.PSKIdentity pskIdentity = BusinessLogicFactory.Identities.GetPSKIdentity(identity); if (pskIdentity == null) result = new NotFoundResult(); else { ServiceModels.PSKIdentity response = new ServiceModels.PSKIdentity(pskIdentity); string rootUrl = Request.GetRootUrl(); response.AddSelfLink(string.Concat(rootUrl, "/identities/psk/", response.Identity), false, true); result = Request.GetObjectResult(response); } return result; }
public IActionResult GetPSKIdentities() { IActionResult result = null; string rootUrl = Request.GetRootUrl(); PSKIdentities response = new PSKIdentities(); response.AddLink("add", string.Concat(rootUrl, "/identities/psk"), null); int organisationID = User.GetOrganisationID(); List<Model.PSKIdentity> pskIdentities = BusinessLogicFactory.Identities.GetPSKIdentities(organisationID); response.PageInfo = Request.GetPageInfo(pskIdentities.Count); int endIndex = response.PageInfo.StartIndex + response.PageInfo.ItemsCount; for (int index = response.PageInfo.StartIndex; index < endIndex; index++) { ServiceModels.PSKIdentity pskIdentity = new ServiceModels.PSKIdentity(pskIdentities[index]); pskIdentity.AddSelfLink(string.Concat(rootUrl, "/identities/psk/", pskIdentity.Identity), false, true); response.Add(pskIdentity); } result = Request.GetObjectResult(response); return result; }