Ejemplo n.º 1
0
        public IActionResult EditProfile()
        {
            _commander.Execute <GetCurrentClaims, IEnumerable <Claim> >(HttpContext.User.Claims);
            _commander.Execute <GetUserData, NewUserModel>((NewUserModel)_commander.GetResult()[0]);

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

            return(View(getUserData.FullData));
        }
Ejemplo n.º 2
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"));
            }
        }