public IActionResult UpdateParty(int partyId, PartyRequestModel partyRequestModel)
        {
            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.UpdateParty(partyId, partyRequestModel);
                    if (result != null)
                    {
                        var success = true;
                        var message = "party Updated";
                        return(Ok(new { success, message, result }));
                    }
                    else
                    {
                        var success = false;
                        var message = "Failed Updation";
                        return(BadRequest(new { success, message }));
                    }
                }
            }
            return(BadRequest("used invalid token"));
        }
Beispiel #2
0
        public IActionResult UpdateParty(int PartyId, UpdatePartyRequestModel updateParty)
        {
            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")
                    {
                        UpdatepartyResponseModel updatePartyModel = _partyBusiness.UpdateParty(PartyId, updateParty);

                        if (updatePartyModel != null)
                        {
                            if (updatePartyModel.ErrorResponse.ErrorStatus)
                            {
                                message = updatePartyModel.ErrorResponse.Message;
                                return(Ok(new { status, message }));
                            }
                            status  = true;
                            message = "Party Name has Been Updated";
                            PartyUpdatedResponseModel data = updatePartyModel.PartyUpdated;
                            return(Ok(new { status, message, data }));
                        }
                        message = "Unable to update the Party Name";
                        return(Ok(new { status, message }));
                    }
                }
                message = "Invalid Token";
                return(BadRequest(new { status, message }));
            }
            catch (Exception e)
            {
                return(BadRequest(new { e.Message }));
            }
        }