public async Task <IActionResult> ReturnInfoAnaf(InfoAnafViewModel model) { model.data = DateTime.Today.ToString("yyyy-MM-dd"); HttpResponseMessage result = await client.PostAsJsonAsync( "https://webservicesp.anaf.ro/PlatitorTvaRest/api/v3/ws/tva", new List <InfoAnafViewModel>() { model }); HttpContent content = result.Content; string resultContent = await content.ReadAsStringAsync(); ReturnedInfoAnafViewModel returnedInfo = new ReturnedInfoAnafViewModel(); if (resultContent != null) { dynamic json = JValue.Parse(resultContent); dynamic requestedFirm = json.found[0]; returnedInfo = new ReturnedInfoAnafViewModel { cui = requestedFirm.cui, Address = requestedFirm.adresa, FirmName = requestedFirm.denumire, scpTVA = requestedFirm.scpTVA, }; } else { return(RedirectToAction("ErrorRegister")); } return(View(returnedInfo)); }
public ActionResult Register(ReturnedInfoAnafViewModel model) { UserModel newUser = new UserModel { Email = model.Email, Password = model.Password, ConfirmPassword = model.ConfirmPassword, cui = model.cui, FirmName = model.FirmName, Address = model.Address, scpTVA = model.scpTVA }; userRepository.Insert(newUser); return(RedirectToAction("RegistrationConfirmation")); }