Beispiel #1
0
        public async Task <IActionResult> Login(LoginUserModel user)
        {
            if (ModelState.IsValid)
            {
                _commander.Execute <LoginAction, LoginUserModel>(user);
                var loginAction = _commander.GetInstance <LoginAction>();

                if (loginAction.LoggedInUserData != null &&
                    !string.IsNullOrEmpty(loginAction.LoggedInUserData.UserName) &&
                    !string.IsNullOrEmpty(loginAction.LoggedInUserData.Email))
                {
                    await SetLoginClaims(new NewUserModel()
                    {
                        Email = loginAction.LoggedInUserData.Email, UserName = loginAction.LoggedInUserData.UserName
                    });

                    return(RedirectToRoute("homepage"));
                }
                else
                {
                    ViewBag.Message = "Kimlik doğrulaması başarısız.";
                    ViewBag.Success = false;
                    return(View("SignIn"));
                }
            }
            else
            {
                ViewBag.Message = "Geçersiz CAPTCHA";
                ViewBag.Success = false;
                return(View("SignIn"));
            }
        }
Beispiel #2
0
        public async Task SupportsEnlistingInAmbientTransactions(TransactionScopeOption scopeOption)
        {
            var name  = Enum.GetName(typeof(TransactionScopeOption), scopeOption);
            var pocoA = new PocoA {
                Name = $"{name}--{Guid.NewGuid()}", Value = 1
            };
            var pocoB = new PocoB {
                Name = $"{name}--{Guid.NewGuid()}", Value = 2
            };

            var result = await _commander.ExecuteAsync(() =>
            {
                var t1 = _commander.Execute(pocoA) ? pocoA : null;
                var t2 = _commander.Execute(pocoB) ? pocoB : null;

                return(new MultiMapPocoB
                {
                    PocoA = t1,
                    PocoB = t2
                });
            }, scopeOption);

            NotNull(result);
            NotNull(result.PocoA);
            NotNull(result.PocoB);
        }
Beispiel #3
0
        public IActionResult Index()
        {
            _commander.Execute <GetCurrentClaims, IEnumerable <Claim> >(HttpContext.User.Claims);

            var getCurrentClaims = _commander.GetInstance <GetCurrentClaims>();

            return(View(getCurrentClaims.User));
        }
Beispiel #4
0
        //REF: http://docs.hangfire.io/en/latest/best-practices.html#make-job-arguments-small-and-simple
        /// <summary>
        /// Called on a background thread by Hangfire, keep parameters simple for serialization.
        /// </summary>
        public void Execute(int queueItemId)
        {
            var queueItem = _db
                .Query<QueueItem>()
                .Single(x => x.Id == queueItemId);

            queueItem.Status = QueueItem.RUNNING;
            queueItem.Started = _clock.Now();

            _db.Commit();

            try
            {
                var result = (TaskResult)_commander.Execute(queueItem.Type, queueItem.Data);

                queueItem.Status = QueueItem.COMPLETED;
                queueItem.Completed = _clock.Now();
                queueItem.Log = result.Log;
            }
            catch (Exception ex)
            {
                queueItem.Status = QueueItem.ERROR;
                queueItem.Completed = _clock.Now();
                queueItem.Log = ex.Message;
            }

            _db.Commit();
        }
Beispiel #5
0
 private object Execute(string commandName, string commandJson)
 {
     try
     {
         return(_commander.Execute(commandName, commandJson));
     }
     catch (Exception ex)
     {
         return(CommandResponse.Error(ex.ToString()));
     }
 }
Beispiel #6
0
        private void FileChanged(object sender, FileSystemEventArgs e)
        {
            if (!_ignorePatternCollection.ShouldIgnore(e.Name))
            {
                if (DateTime.Now.Subtract(_lastFileChanged).TotalMilliseconds < 1000)
                {
                    return;
                }

                _logger.Info($"{e.Name} changed...");
                _commander.Execute(e.Name);

                _lastFileChanged = DateTime.Now;
            }
        }
Beispiel #7
0
        public IActionResult CreateGroupPost(CreateGroupModel createGroupModel, string mediaLink1Title, string mediaLink1, string mediaLink2Title, string mediaLink2, string mediaLink3Title, string mediaLink3)
        {
            if (ModelState.IsValid)
            {
                _commander.Execute <GetCurrentClaims, IEnumerable <Claim> >(HttpContext.User.Claims);
                _commander.Execute <GetUserData, NewUserModel>((NewUserModel)_commander.GetResult()[0]);

                var getUserData = _commander.GetInstance <GetUserData>();

                var MediaLinks = new List <MediaLink>();

                if (!string.IsNullOrEmpty(mediaLink1) && !string.IsNullOrEmpty(mediaLink1Title))
                {
                    MediaLinks.Add(new MediaLink()
                    {
                        Link = mediaLink1, LinkTitle = mediaLink1Title
                    });
                }

                if (!string.IsNullOrEmpty(mediaLink2) && !string.IsNullOrEmpty(mediaLink2Title))
                {
                    MediaLinks.Add(new MediaLink()
                    {
                        Link = mediaLink2, LinkTitle = mediaLink2Title
                    });
                }

                if (!string.IsNullOrEmpty(mediaLink3) && !string.IsNullOrEmpty(mediaLink3Title))
                {
                    MediaLinks.Add(new MediaLink()
                    {
                        Link = mediaLink3, LinkTitle = mediaLink3Title
                    });
                }

                _commander.Execute <CreateGroupAction, object[]>(new object[] {
                    getUserData.FullData,
                    createGroupModel,
                    MediaLinks
                });

                var result = (bool)_commander.GetResult()[0];

                if (result)
                {
                    ViewBag.Message = "Grup başarıyla oluşturuldu.";
                    ViewBag.Success = true;

                    return(View("CreateGroup"));
                }
                else
                {
                    ViewBag.Message = "Form alanlarını doğru doldurduğunuzdan emin olun!";
                    ViewBag.Success = false;

                    return(View("CreateGroup"));
                }
            }
            else
            {
                ViewBag.Message = "Form alanlarını doğru doldurduğunuzdan emin olun!";
                ViewBag.Success = false;

                return(View("CreateGroup"));
            }
        }
Beispiel #8
0
 private void CreateDistributedTransactionTable()
 {
     _commander.Execute <bool>();
 }
Beispiel #9
0
 public void Record(string client, string documentId, IEnumerable <string> keywords)
 {
     _commander.Execute(new { client, documentId, keywords = string.Join(",", keywords) });
 }
Beispiel #10
0
 private void CreateTable(string tableName)
 {
     _commander.Execute(new { tableName });
 }