Beispiel #1
0
        public IActionResult GetPartyId(int PartyId)
        {
            try
            {
                var    admin  = HttpContext.User;
                bool   status = false;
                string message;

                if (admin.HasClaim(c => c.Type == "TokenType"))
                {
                    if (admin.Claims.FirstOrDefault(c => c.Type == "TokenType").Value == "Login")
                    {
                        PartyCreatedResponseModel data = _partyBusiness.GetPartyById(PartyId);

                        if (data != null)
                        {
                            status  = true;
                            message = "Here is the Party Details";
                            return(Ok(new { status, message, data }));
                        }
                        message = "Unable to get the Party Details";
                        return(Ok(new { status, message }));
                    }
                }
                message = "Invalid Token";
                return(BadRequest(new { status, message }));
            }
            catch (Exception e)
            {
                return(BadRequest(new { e.Message }));
            }
        }
        public IActionResult GetPartyById(int partyId)
        {
            var user = HttpContext.User;
            PartyresponseModel result = new PartyresponseModel();

            if (user.HasClaim(c => c.Type == "Typetoken"))
            {
                if (user.Claims.FirstOrDefault(c => c.Type == "Typetoken").Value == "Login")
                {
                    result = partyBL.GetPartyById(partyId);
                    if (result != null)
                    {
                        var success = true;
                        var message = "party Details";
                        return(Ok(new { success, message, result }));
                    }
                    else
                    {
                        var success = false;
                        var message = "party Details getting failed";
                        return(Ok(new { success, message }));
                    }
                }
            }
            return(BadRequest("used invalid token"));
        }