public IActionResult GetAllParty() { var user = HttpContext.User; IList <PartyresponseModel> partylist = new List <PartyresponseModel>(); if (user.HasClaim(c => c.Type == "Typetoken")) { if (user.Claims.FirstOrDefault(c => c.Type == "Typetoken").Value == "Login") { partylist = partyBL.GetAllParty(); if (partylist != null) { var success = true; var message = "All party Details"; return(Ok(new { success, message, partylist })); } else { var success = false; var message = "Failed getting detail"; return(BadRequest(new { success, message })); } } } return(BadRequest("used invalid token")); }
public IActionResult GetAllParty() { 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") { List <PartyCreatedResponseModel> data = _partyBusiness.GetAllParty(); if (data != null) { if (data.Count == 0) { message = "No Party Data is Present"; return(Ok(new { status, message })); } else { status = true; message = "Here is the list of all Party"; return(Ok(new { status, message, data })); } } message = "Unable to get all the party"; return(Ok(new { status, message })); } } message = "Invalid Token"; return(BadRequest(new { status, message })); } catch (Exception e) { return(BadRequest(new { e.Message })); } }