public HttpResponseMessage UpdateProfile(UpdateShape LoginUser) { try { string Login = string.Empty; ClassUserAccount Resp = new ClassUserAccount(); DataTable dt = new DataTable(); string UserID = ""; string Messages = ""; if (isUpdatValidate(LoginUser, ref UserID)) { Messages = Resp.FN_UpdateProfile(LoginUser); return(Request.CreateResponse(HttpStatusCode.OK, Messages)); } else { return(Request.CreateResponse(HttpStatusCode.Unauthorized, UserID)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "500_INTERNAL_SERVER_ERROR")); } }
private bool isUpdatValidate(UpdateShape LT, ref string OutMsg) { bool isValid = true; if (string.IsNullOrEmpty(LT.Number) || LT.Number.Length == 0) { isValid = false; OutMsg += "\n" + "Mobile" + " : " + "Required_Field"; } if (string.IsNullOrEmpty(LT.Email) || LT.Email.Length == 0) { isValid = false; OutMsg += "\n" + "Email" + " : " + "Required_Field"; } return(isValid); }
public string FN_UpdateProfile(UpdateShape LoginUser) { string status = ""; string AppMstRegNo = ""; SqlConnection con = new SqlConnection(method.str); SqlCommand com = new SqlCommand("UpdateProfileAPP", con); com.CommandType = CommandType.StoredProcedure; com.CommandTimeout = 99999999; com.Parameters.AddWithValue("@regno", LoginUser.Regno); com.Parameters.AddWithValue("@Btc", LoginUser.BTC.Trim()); com.Parameters.AddWithValue("@Country", LoginUser.Country.Trim()); com.Parameters.AddWithValue("@mobileno", "NA"); com.Parameters.AddWithValue("@emailid", LoginUser.Email.Trim()); com.Parameters.AddWithValue("@FName", LoginUser.AppmstFName.Trim()); com.Parameters.Add("@flag", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output; try { con.Open(); com.CommandTimeout = 999999; com.ExecuteNonQuery(); status = com.Parameters["@flag"].Value.ToString(); if (status == "1") { AppMstRegNo = "Update Profile"; } else { AppMstRegNo = status; } } catch (Exception ex) { AppMstRegNo = status; } return(AppMstRegNo); }