public HttpResponseMessage SaveDeviceID(ENT.Device obj) { DAL.Device objDAL = new DAL.Device(); try { if (!string.IsNullOrWhiteSpace(obj.DeviceId) && !string.IsNullOrWhiteSpace(obj.DeviceCode)) { if (objDAL.InsertUpdateDeleteDeviceID(obj)) { return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { response = "Data save successfully." })); } else { throw new Exception("Internal Server Error."); } } else { return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { response = "Device ID and Device Token should not be empty or null or white space." })); } } catch (Exception ex) { ERRORREPORTING.Report(ex, Request.RequestUri.AbsoluteUri, new Guid("00000000-0000-0000-0000-000000000000"), "Gujarat_Intrux", "Function Name : SaveDeviceID()"); return(ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { ex.Message })); } }
/// <summary> /// This function is return all device token list from database /// </summary> /// <returns>String(DeviceID)</returns> public List <ENT.Device> getDeviceID() { List <ENT.Device> lstENT = new List <ENT.Device>(); try { lstENT = new DAL.Device().GetAllDeviceID(); } catch (Exception ex) { ERRORREPORTING.Report(ex, Request.RequestUri.AbsoluteUri, new Guid("00000000-0000-0000-0000-000000000000"), "Gujarat_Intrux", "Function Name : getDeviceID()"); } return(lstENT); }
public HttpResponseMessage GetLastDeviceID() { DAL.Device objDAL = new DAL.Device(); string response = ""; try { List <ENT.Device> lstENT = objDAL.GetLastDeviceID(); if (lstENT.Count > 0) { response = lstENT[0].DeviceId; } else { response = "Record not found."; } } catch (Exception ex) { ERRORREPORTING.Report(ex, Request.RequestUri.AbsoluteUri, new Guid("00000000-0000-0000-0000-000000000000"), "Gujarat_Intrux", "Function Name : GetLastDeviceID()"); return(ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { ex.Message })); } return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { response })); }