public ActionResult Edit(ProfileUpdateView model) { if (ModelState.IsValid) { model = _taService.UpdateProfile(model); if (model.Success) { CurrentTravelerProfileCache = null; if (Request.IsAjaxRequest()) return Json(model); TempData["NotificationMessage"] = R.String.SuccessMessages.SuccessProfileUpdate; return RedirectToAction("Edit"); } else { ModelState.AddModelError("", model.ResponseMessage); } } //TODO: handle situation when model is not valid and return proper error for ajax calls return View(model); }
public ProfileUpdateView UpdateProfile(ProfileUpdateView view) { UpdateProfileRequest request = (UpdateProfileRequest)GetMappedObject(view, typeof(UpdateProfileRequest)); return (ProfileUpdateView)GetMappedObject(_travelersAroundService.UpdateProfile(request), typeof(ProfileUpdateView)); }