public async Task <JsonResult> EditTranslator(TranslatorModel vm) { try { bool isValidCulturesList = await Cultures.IsValidCulturesListAsync(vm.Cultures, _translationService); if (!isValidCulturesList) { return(Json(new GenericResponse(false, AppResources.InvalidCultureList))); } var user = vm.ToUser(); await _translationService.UpdateUserAsync(user); } catch (Exception ex) { Trace.TraceError(ex.ToString()); return(Json(new GenericResponse(false, ex.Message))); } return(Json(new GenericResponse(true, AppResources.GenericSaveSuccess))); }
public async Task <JsonResult> CreateNewTranslator(TranslatorModel vm) { try { bool isValidCulturesList = await Cultures.IsValidCulturesListAsync(vm.Cultures, _translationService); if (!isValidCulturesList) { return(Json(new GenericResponse(false, AppResources.InvalidCultureList))); } var user = vm.ToNewUser(); await _translationService.CreateUserAsync(user, MailTemplates.NewUserSubjectFormat, MailTemplates.NewUserBodyFormat, ApplicationInformation.Current.GetSiteBaseUrl(this)); } catch (Exception ex) { Trace.TraceError(ex.ToString()); return(Json(new GenericResponse(false, ex.Message))); } return(Json(new GenericResponse(true, AppResources.GenericSaveSuccess))); }