public ActionResult EditProfile(ProfileViewModel model) { if (ModelState.IsValid) { try { profDataRep.Edit(model.Profile); profDataRep.Save(); this.SearchOrCreateBTCustomer(model.Profile); return Json(new { redirectUrl = Url.Action("EditProfileSuccess") }); } catch (Exception e) { ModelState.AddModelError("PersError", "GenericError"); } } //If we got this far, something failed, redisplay form return PartialView("_EditProfile", model); }
// // GET: /Account/EditProfile public ActionResult EditProfile(String view) { var profile = profDataRep.GetSingle(this.CurrentUser.ToString()); // return View(profile); ViewBag.StatusCc = ""; if (profile.BrainTreeToken != null) { ViewBag.StatusCc = "ok"; } try { CreditCard creditCard = Constants.Gateway.CreditCard.Find(profile.BrainTreeToken ?? ""); profile.CardIsValid = true; } catch (NotFoundException) { profile.CardIsValid = false; } var temp = new ProfileViewModel(); temp.Profile = profile; ViewBag.ActionMethod = "EditProfile"; return View(view, temp); }