public Object EditDeviceDetails([FromBody] MobileDeviceInput DeviceInput) { string sJSONResponse = ""; DataTable dt_AppType = new DataTable(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); int a = 0; string AppType_Query = ""; MobileDeviceplanOutput mdpop = new MobileDeviceplanOutput(); try { cnn.Open(); AppType_Query = "update MobileDeviceDetails set Status=" + DeviceInput.status + " where MobileDeviceId='" + DeviceInput.mobileDeviceId + "' "; SqlCommand tm_cmd = new SqlCommand(AppType_Query, cnn); a = Convert.ToInt32(tm_cmd.ExecuteScalar()); mdpop.status = "success"; } catch (Exception ex) { mdpop.status = "Fail"; } finally { cnn.Close(); } sJSONResponse = JsonConvert.SerializeObject(mdpop); return(sJSONResponse); }
public Object DeviceDetails([FromBody] MobileDeviceInput DeviceInput) { ArrayList arl_MobileExist = new ArrayList(); string sJSONResponse = ""; DataTable dt_AppType = new DataTable(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); int a = 0; string AppType_Query = ""; MobileDeviceplanOutput mdpop = new MobileDeviceplanOutput(); try { cnn.Open(); if (arl_MobileExist[0].ToString() == "0") { AppType_Query = "insert into MobileDeviceDetails(RegisteredToken,MobileDeviceId,Status,IsDeleted,IsActive) values('" + DeviceInput.registeredToken + "','" + DeviceInput.mobileDeviceId + "','" + DeviceInput.status + "',0,1) "; } else if (arl_MobileExist[0].ToString() == "1" && arl_MobileExist[0].ToString() == "0") { AppType_Query = "update Users set MobileDeviceId='" + DeviceInput.mobileDeviceId + "' where MobileNo='" + DeviceInput.mobileNo + "'"; } SqlCommand tm_cmd = new SqlCommand(AppType_Query, cnn); a = Convert.ToInt32(tm_cmd.ExecuteScalar()); mdpop.status = "success"; } catch (Exception ex) { mdpop.status = "Fail"; } finally { cnn.Close(); } sJSONResponse = JsonConvert.SerializeObject(mdpop); return(sJSONResponse); }