public IHttpActionResult FMAppRegister(dynamic data) { string value = token_gen.Authorize_aesdecrpty(data); try { string mappath = HttpContext.Current.Server.MapPath("FormerMechanizationSaveLogs"); Task WriteTask = Task.Factory.StartNew(() => new Logdatafile().Write_ReportLog_Exception(mappath, value)); //string value = JsonConvert.SerializeObject(data); FMReg rootobj = JsonConvert.DeserializeObject <FMReg>(value); return(Ok(_Hel.FMAppRegister(rootobj))); } catch (Exception ex) { dynamic CatchData = new ExpandoObject(); CatchData.Status = 102; CatchData.Reason = "Error While Submitting Application Data"; return(Ok(CatchData)); } }
public dynamic FMAppRegister(FMReg oj) { dynamic obj = new ExpandoObject(); try { var val = PostFMData("https://agrimachinery.nic.in/api/FarmerRegistration/Regis?value={StateCode:28,DistrictCode:'" + oj.DistrictCode + "',BlockCode:'" + oj.BlockCode + "',SubDistrictCode:'" + oj.SubDistrictCode + "',PanchayatCode:'" + oj.PanchayatCode + "',VillageCode:'" + oj.VillageCode + "',AadharNo:'" + oj.AadharNo + "',MobileNo:'" + oj.MobileNo + "',FarmerName:'" + oj.FarmerName + "',FatherHusbandName:'" + oj.FatherHusbandName + "',DOB:'" + oj.DOB + "',Gender:'" + oj.Gender + "',CasteCategory:'" + oj.CasteCategory + "',FarmerType:'" + oj.FarmerType + "',Phone:'" + oj.Phone + "',EmailId:'" + oj.EmailId + "',PinCode:'" + oj.PinCode + "',Address:'" + oj.Address + "',UserID:'" + oj.UserID + "',Password:'******',AadharConcent:true,PAN:'" + oj.PAN + "',CentralUnique_BenID:'" + oj.CentralUnique_BenID + "',Key:'APagri1234'}", ""); var data = GetSerialzedData <dynamic>(val); obj.Status = 100; obj.Reason = "Data Submitted Successfully."; obj.Details = data; } catch (WebException wex) { string mappath = HttpContext.Current.Server.MapPath("FormerMechanizationExceptionLogs"); Task WriteTask = Task.Factory.StartNew(() => new Logdatafile().Write_ReportLog_Exception(mappath, "Error Submitting FormerMechanization Data API:" + wex.Message.ToString())); obj.Status = 102; obj.Reason = "Error Occured While Submitting Data."; } return(obj); }