Exemplo n.º 1
0
        public ActionResult GetBlockUser(Guid?Id)

        {
            BlockModel blockModel = new BlockModel();

            blockModel.BlockedUser  = Id.ToString();
            blockModel.BlockingUser = System.Web.HttpContext.Current.User.Identity.GetUserId();

            try
            {
                var result = data.GetBlockUser(SessionToken, blockModel);
                if (result.Entity.BlockedUser != null)
                {
                    var status = result.Entity.Status == null ? null : result.Entity.Status;
                    System.Web.HttpContext.Current.Session["BlockStatus"] = status;
                    return(Json(new { status }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    System.Web.HttpContext.Current.Session["BlockStatus"] = false;
                    return(Json(new { }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(View("~/Views/Errorpage/Errorpage.cshtml"));
            }
        }
        public ActionResult Home1(string name)
        {
            string Email  = null;
            Guid   UserId = Guid.Empty;

            //  var e = Request.Form["MyInput"].ToString();
            Email = name;
            bool?accountActivation = null;
            // var Email = fc["MyInput"].ToString();
            var obj = new ApplicationMandatoryService();    var userdata = Session["UserData"] as List <AspnetUsersModel>;

            if (userdata != null)
            {
                foreach (var i in userdata)
                {
                    if (Email == i.Email)
                    {
                        UserId            = Guid.Parse(i.Id);
                        accountActivation = i.UserActive;

                        break;
                    }
                }
                if (accountActivation == false)
                {
                    return(View("~/Views/Account/UserDeactivatedView.cshtml"));
                }
            }

            var basicService = new BasicFunctionalityofentireappService();
            var blockModel   = new BlockModel();


            blockModel.BlockedUser  = User.Identity.GetUserId();
            blockModel.BlockingUser = UserId.ToString();

            var blockedCheck = basicService.GetBlockUser(SessionToken, blockModel).Entity.Status;

            if (blockedCheck != null)
            {
                if (blockedCheck == true)
                {
                    return(View("~/Views/Account/UserDeactivatedView.cshtml"));
                }
            }

            return(RedirectToAction("ProfilePage", new { UserId = UserId }));
        }