public static PersoanlInfoModel CastPersonalInfoToModelWithoutPic(vwUserInfo ui) { var pi = new PersoanlInfoModel(); pi.Mobile = ui.UserName; pi.Name = ui.Name; pi.Family = ui.Family; pi.Gender = (Gender)ui.Gender; pi.NationalCode = ui.NationalCode; pi.Email = ui.Email; pi.UserUId = ui.UserUId; return(pi); }
public ActionResult SubmitPersonalInfo(PersoanlInfoModel model) { if (ModelState.IsValid) { var token = GetUserToken(); if (string.IsNullOrEmpty(token)) { return(Json(new { status = "UnAuthorized" }, JsonRequestBehavior.AllowGet)); } var res = _userManager.SubmitPersonalInfo(model, token); return(Json(res, JsonRequestBehavior.AllowGet)); } return(Json(new { status = "WrongInfo" }, JsonRequestBehavior.AllowGet)); }
public PersoanlInfoModel GetPersonalInfo(string token) { var client = new RestClient(ApiUrl); var request = new RestRequest("GetPersonalInfo", Method.POST); request.AddHeader("Authorization", "Bearer " + token); IRestResponse response = client.Execute(request); JavaScriptSerializer js = new JavaScriptSerializer(); PersoanlInfoModel piModel = new PersoanlInfoModel(); if (!string.IsNullOrWhiteSpace(response.Content)) { piModel = js.Deserialize <PersoanlInfoModel>(response.Content); } return(piModel); }
public RequestReponse SubmitPersonalInfo(PersoanlInfoModel model, string clientToken) { var client = new RestClient(ApiUrl); var request = new RestRequest("InsertPersoanlInfo", Method.POST); request.AddHeader("Authorization", "Bearer " + clientToken); request.AddHeader("Content-Type", "multipart/form-data"); request.AddParameter("Name", model.Name); request.AddParameter("Family", model.Family); request.AddParameter("NationalCode", model.NationalCode); request.AddParameter("Gender", model.Gender); request.AddParameter("Email", model.Email); IRestResponse response = client.Execute(request); JavaScriptSerializer js = new JavaScriptSerializer(); RequestReponse PersonalInfoResponseModel = new RequestReponse(); if (!string.IsNullOrWhiteSpace(response.Content)) { PersonalInfoResponseModel = js.Deserialize <RequestReponse>(response.Content); } return(PersonalInfoResponseModel); }