public ActionResult Dpd() { DPDAction dpd_action = new DPDAction( _eventtrackingRepository, _eventtrackingtypeRepository, _eventtrackingparameterRepository, _eventtrackingunitloadRepository, _stateparcelsRepository, _stateRepository, _stateparcelsunitedRepository, _stateunitedRepository, _statehistoryRepository, _eventsRepository ); DPDActionResult result = dpd_action.Go(); if (result.IsOk) { //_timelineService.RegisterActivity(Realm.BG, ActivityType.LocationDeleted, User.Id); Feedback.AddMessageSuccess(result.Message); return(RedirectToAction("Index", nameof(DashboardController).RemoveControllerSuffix())); } else { Feedback.AddMessageWarning(result.Message); return(RedirectToAction("Index", nameof(DashboardController).RemoveControllerSuffix())); } }
public ActionResult Add(CategoryViewModel model) { if (ModelState.IsValid) { if (model.ParentId == null || model.ParentId == 0) { model.Level = 0; } else { model.Level = 1; } model.AddedBy = User.Id.ToString(); var entity = Mapper.Map <Category>(model); entity = _categoryRepository.Create(entity); //_timelineService.RegisterActivity(Realm.Admin, ActivityType.CategoryCreated, User.Id); //Feedback.AddMessageSuccess(CategoryResources.CategoryAddSuccessMessage); Feedback.AddMessageSuccess("Категория успешно добавлена"); return(RedirectToAction(nameof(Index), nameof(CategoryController).RemoveControllerSuffix())); } model = BuilModel(model); return(View("Manager", model)); }
public ActionResult Edit(ArticleViewModel model) { if (ModelState.IsValid) { // model.Path = Transliter.Trans(model.Title).ToUrlFormat(); // model.OnlyForMembers = true; model.Abstract = "-"; var entity = Mapper.Map <Article>(model); entity = _articleRepository.Update(entity); //_timelineService.RegisterActivity(Realm.BG, ActivityType.LocationUpdated, User.Id); //Feedback.AddMessageSuccess(ArticleResources.ArticleEditSuccessMessage); Feedback.AddMessageSuccess("Категория успешно отредактирована !"); return(RedirectToAction(nameof(Index), nameof(ArticleController).RemoveControllerSuffix())); } model = BuilModel(model); return(View("Manager", model)); }
public ActionResult Add(ArticleViewModel model) { if (ModelState.IsValid) { // model.AddedBy = User.Id.ToString(); // model.Path = Transliter.Trans(model.Title).ToUrlFormat(); // model.OnlyForMembers = true; // model.ViewCount = 0; // model.Votes = 0; // model.TotalRating = 0; model.Abstract = "-"; var entity = Mapper.Map <Article>(model); entity = _articleRepository.Create(entity); //_timelineService.RegisterActivity(Realm.Admin, ActivityType.ArticleCreated, User.Id); //Feedback.AddMessageSuccess(ArticleResources.ArticleAddSuccessMessage); Feedback.AddMessageSuccess("Статья успешно добавлена"); return(RedirectToAction(nameof(Index), nameof(ArticleController).RemoveControllerSuffix())); } model = BuilModel(model); return(View("Manager", model)); }
public ActionResult Add(TagViewModel model) { if (ModelState.IsValid) { var entity = Mapper.Map <Tag>(model); entity = _tagRepository.Create(entity); Feedback.AddMessageSuccess(TagResources.TagAddSuccessMessage); return(RedirectToAction(nameof(Index), nameof(TagController).RemoveControllerSuffix())); } model = BuilModel(model); return(View("Manager", model)); }
public async Task <ActionResult> Account(UserViewModel model, string statusMessageUpdate = null) { if (ModelState.IsValid) { model.Id = User.Id; if (!statusMessageUpdate.IsNullOrEmpty()) { model.StatusMessage = statusMessageUpdate; } var user = Mapper.Map <User>(model); user = _usersRepository.UpdateProfile(user); await RefreshUserClaims(model.Id); var successMessage = string.Empty; switch (model.CurrentTab) { case UserAccountTabs.Overview: _timelineService.RegisterActivity(Realm.BG, ActivityType.UpdatedItsOwnStatusMessage, user.Id); successMessage = UserResources.OverviewDataSuccessMessage; break; case UserAccountTabs.ProfileInfo: _timelineService.RegisterActivity(Realm.BG, ActivityType.UpdatedItsOwnProfileInformation, user.Id); successMessage = UserResources.ProfileDataUpdatedSuccessMessage; break; case UserAccountTabs.GeneralSettings: _timelineService.RegisterActivity(Realm.BG, ActivityType.UpdatedItsOwnGeneralSettings, user.Id); successMessage = UserResources.SettingsDataUpdatedSuccessMessage; break; } Feedback.AddMessageSuccess(successMessage); ConfigureGlobalizationContext(HttpContext, model.CurrentCultureId, model.CurrentUICultureId, model.TimeZoneId); return(RedirectToAction(nameof(Account), new { @tab = model.CurrentTab.ToSlug() })); } // Remap keeping the posted information var entity = _usersRepository.GetById(User.Id); model = Mapper.Map <UserViewModel>(entity, model); return(GetAccountView(model)); }
public ActionResult Edit(ContactViewModel model) { if (ModelState.IsValid) { var entity = Mapper.Map <Contact>(model); entity = _contactsRepository.Update(entity); _timelineService.RegisterActivity(Realm.BG, ActivityType.ContactUpdated, User.Id); Feedback.AddMessageSuccess(ContactResources.ContactEditSuccessMessage); return(RedirectToAction(nameof(Index), nameof(ContactsController).RemoveControllerSuffix())); } model = BuildModel(model); return(View("Manager", model)); }
public ActionResult EventsEdit([ModelBinder(typeof(CalendarEventViewModelBinder))] CalendarEventViewModel model) { if (ModelState.IsValid) { var entity = Mapper.Map <Event>(model); entity = _eventsRepository.Update(entity); _timelineService.RegisterActivity(Realm.BG, ActivityType.EventUpdated, User.Id); Feedback.AddMessageSuccess(CalendarResources.EventEditSuccessMessage); return(RedirectToAction(nameof(EventsIndex), nameof(CalendarController).RemoveControllerSuffix())); } model = BuildModel(model); return(View("EventManager", model)); }
public ActionResult Add(LocationViewModel model) { if (ModelState.IsValid) { var entity = Mapper.Map <Location>(model); entity = _locationsRepository.Create(entity); _timelineService.RegisterActivity(Realm.BG, ActivityType.LocationCreated, User.Id); Feedback.AddMessageSuccess(LocationResources.LocationAddSuccessMessage); return(RedirectToAction(nameof(Index), nameof(LocationsController).RemoveControllerSuffix())); } model = BuilModel(model); return(View("Manager", model)); }
public ActionResult Edit(EventTypeViewModel model) { if (ModelState.IsValid) { var entity = Mapper.Map <EventType>(model); entity = _eventtypeRepository.Update(entity); //_timelineService.RegisterActivity(Realm.BG, ActivityType.LocationUpdated, User.Id); Feedback.AddMessageSuccess(EventTypeResources.LocationEditSuccessMessage); return(RedirectToAction(nameof(Index), nameof(EventTypeController).RemoveControllerSuffix())); } model = BuilModel(model); return(View("Manager", model)); }
public ActionResult Edit(CategoryViewModel model) { if (ModelState.IsValid) { var entity = Mapper.Map <Category>(model); entity = _categoryRepository.Update(entity); //_timelineService.RegisterActivity(Realm.BG, ActivityType.LocationUpdated, User.Id); //Feedback.AddMessageSuccess(CategoryResources.CategoryEditSuccessMessage); Feedback.AddMessageSuccess("Категория успешно отредактирована !"); return(RedirectToAction(nameof(Index), nameof(CategoryController).RemoveControllerSuffix())); } model = BuilModel(model); return(View("Manager", model)); }
public async Task <ActionResult> ChangePassword(UserChangePasswordViewModel model) { if (ModelState.IsValid) { var uId = User.Id; var cPwd = model.Password; var nPwd = model.NewPassword; var result = await _userManager.ChangePasswordAsync(uId, cPwd, nPwd); if (result.Succeeded) { Feedback.AddMessageSuccess(UserResources.PasswordChangeSuccessMessage); return(RedirectToAction(nameof(UsersController.Account), nameof(UsersController).RemoveControllerSuffix(), new { tab = UserAccountTabs.GeneralSettings.ToSlug() })); } ModelState.AddModelError("Password", UserResources.ChangePasswordCurrentInvalidMessage); } return(View(model)); }
public ActionResult UsersEdit(int id, PlatformUserViewModel model) { var entity = _usersRepository.GetById(id); if (ModelState.IsValid) { entity.Roles = model.Roles.Select(r => new UserRole() { Role = r.ChangeType <Role>(), UserId = id }).ToList(); entity = _usersRepository.UpdateIdentity(entity); Feedback.AddMessageSuccess(UserResources.UserEditSuccessMessage); return(RedirectToAction(nameof(Users), nameof(PlatformController).RemoveControllerSuffix())); } model = Mapper.Map <PlatformUserViewModel>(entity, model); model = BuildModel(model); return(View("UsersManager", model)); }