public ActionResult Edit(RemoteAuthenticationManageModel model, SubmitType submit) { if (ModelState.IsValid) { var response = _remoteAuthenticationService.SaveRemoteAuthentication(model); SetResponseMessage(response); if (response.Success) { switch (submit) { case SubmitType.Save: return(RedirectToAction("Index")); default: return(RedirectToAction("Edit", new { id = model.Id })); } } } return(View(model)); }
/// <summary> /// Save RemoteAuthentication /// </summary> /// <param name="model"></param> /// <returns></returns> public ResponseModel SaveRemoteAuthentication(RemoteAuthenticationManageModel model) { ResponseModel response; var remoteAuthentication = GetById(model.Id); if (remoteAuthentication != null) { remoteAuthentication.Name = model.Name; remoteAuthentication.ServiceUrl = model.ServiceUrl; remoteAuthentication.AuthorizeCode = model.AuthorizeCode; remoteAuthentication.Active = model.Active; response = Update(remoteAuthentication); return(response.SetMessage(response.Success ? T("RemoteAuthentication_Message_UpdateSuccessfully") : T("RemoteAuthentication_Message_UpdateFailure"))); } Mapper.CreateMap <RemoteAuthenticationManageModel, RemoteAuthentication>(); remoteAuthentication = Mapper.Map <RemoteAuthenticationManageModel, RemoteAuthentication>(model); response = Insert(remoteAuthentication); return(response.SetMessage(response.Success ? T("RemoteAuthentication_Message_CreateSuccessfully") : T("RemoteAuthentication_Message_CreateFailure"))); }