0

I have some stored procedure to add information to a database already. Now I am creating a webpage that allows a user to view certain items within the database. When a user view the page, he or she have the option to edit/update or add a new merchant. I am having difficulties in the controller my method is not taking in the parameters im giving it. If you have any clues or know the answer please share.. Thank You

P.S Whener I hover over the add function it says bool MerchantTypeRef.addMerchantTypeRef(MerchantAdminProductionServices.MerchantTypeRef merchantTypeRef)

Error: The best overloaded method match for 'MerchantAdministrator.Models.MerchantAdminProduction.MerchatTypeRef.addMerchantTypeRef(MerchantAdministrator.MerchantAdminProductionServices.MerchantTypeRef)' has some invalid arguments

Controller

 [MerchantAuthorizeAttribute(AdminRoles = "AddMerchantTypeRef")]
    public ActionResult AddMerchantTypeRef()
    {
        try
        {
            Guid merchantTypeRefId = Request["merchantTypeRefId"] != null ? new Guid(Request["merchantTypeRefId"]) : Guid.Empty;
               string name = Request["name"]?? string.Empty;
            string description = Request["description"]?? string.Empty;
            string xMerchantType = Request["xMerchantTypeRefCode"]??string.Empty;
            DarkstarAdministrator.DarkstarAdminProductionServices.MerchantTypeRef merchantTypeRef = new DarkstarAdministrator.DarkstarAdminProductionServices.MerchantTypeRef();

            merchantTypeRef.name = name;
            merchantTypeRef.description = description;
            merchantTypeRef.xMerchantTypeCode = xMerchantType;
           ViewBag.addMerchantTypeRef = MerchantAdministrator.Models.MerchantAdminProduction.MerchantTypeRef.addMerchantTypeRef(merchantTypeRef);  <------This where I have the Trouble . not reading parameter
        }
        catch (Exception e)
        {
            Commons.ErrorHandling.ReportError("MerchantAdministrator.Controllers.ProdController AddMerchantTypeRef()", e);
        }
        return View();

    }

Model

  public static bool addMerchantTypeRef(DarkstarAdminProductionServices.MerchantTypeRef merchantTypeRef)
    {
        try
        {
            DarkstarAdminProductionServices.DarkstarAdminProductionServicesSoapClient client = new DarkstarAdminProductionServices.DarkstarAdminProductionServicesSoapClient();
            return client.addMerchantTypeRef(merchantTypeRef);
        }
        catch (Exception e)
        {
            Commons.ErrorHandling.ReportError("MerchantTypeRef.addMerchantTypeRef()", e);

        }
        return false;
    }

Reference

 [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)]
    public System.Guid merchantTypeRefId {
        get {
            return this.merchantTypeRefIdField;
        }
        set {
            if ((this.merchantTypeRefIdField.Equals(value) != true)) {
                this.merchantTypeRefIdField = value;
                this.RaisePropertyChanged("merchantTypeRefId");
            }
        }
    }

    [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)]
    public string name {
        get {
            return this.nameField;
        }
        set {
            if ((object.ReferenceEquals(this.nameField, value) != true)) {
                this.nameField = value;
                this.RaisePropertyChanged("name");
            }
        }
    }

    [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=2)]
    public string description {
        get {
            return this.descriptionField;
        }
        set {
            if ((object.ReferenceEquals(this.descriptionField, value) != true)) {
                this.descriptionField = value;
                this.RaisePropertyChanged("description");
            }
        }
    }

    [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=3)]
    public string xMerchantTypeCode
    {
        get {
            return this.xMerchantTypeCodeField;
        }
        set {
            if ((object.ReferenceEquals(this.xMerchantTypeCodeField, value) != true)) {
                this.xMerchantTypeCodeField = value;
                this.RaisePropertyChanged("xMerchantTypeCode");
            }
        }
    }

View

<script type="text/javascript">
$(document).ready(function () {
    $("#merchantTypeUpdateButton").click(function () {
        $("#updateMerchantType").submit();
    });
});

Edit Merchant Type

<%MerchantAdministrator.MerchantAdminProductionServices.MerchantTypeRef     EditMerchantType = ViewBag.MerchantTypeRefEdit !=null ? ViewBag.MerchantTypeRefEdit: new    MerchantAdministrator.DarkstarAdminProductionServices.MerchantTypeRef(); %>
<form id="updateMerchantType" action="<%=Url.Action("EditMerchantTypePost","Prod") %>?    merchantTypeRefId"=<%=EditMerchantType.merchantTypeRefId %>" method="post">
    <table>
        <tr>
            <td colspan="3" class="tableHeader">Merchant Type Ref Details</td>
        </tr>
        <tr>
            <td colspan="2" class="label">Name:</td>
            <td class="content">
                <input type="text" maxlength="100" name="Name" value="  <%=EditMerchantType.name %>" />
        </td>
    </tr>
     <tr>
        <td colspan="2" class="label">Description:</td>
        <td class="content">
            <input type="text" maxlength="2000" name="Description" value="<%=EditMerchantType.description %>" />
        </td>
    </tr>
     <tr>
        <td colspan="2" class="label">Merchant Type Code:</td>
        <td class="content">
            <input type="text" maxlength="5" name="XMerchantTypeCode" value="<%=EditMerchantType.xMerchantTypeCode %>" />
        </td>
    </tr>
    <tr>
        <td colspan="3" class="tableFooter">
                <br />
                <a id="merchantTypeUpdateButton" href="#" class="regularButton">Save</a>
                <a href="javascript:history.back()" class="regularButton">Cancel</a>
        </td>
    </tr>
</table>

4
  • 1
    Your post seems to be incomplete. Did you hit the submit button too soon? (You have the word, "View," but no view code?) Commented Jul 5, 2012 at 17:49
  • 1
    Are you saying that you do not get any value for Request["merchantTypeRefId"]? Commented Jul 5, 2012 at 17:50
  • Is it possible that the addMerchantTypeRef call is failing? You're catching any exceptions so you wouldn't see anything reported back. Are there any log messages showing up? Commented Jul 5, 2012 at 17:52
  • I updated it some more..i figure that i need to do a request to grab information from the fields.. I set the attributes.. I want to make an object can anyone help me.. need object to pass as my parameter Commented Jul 5, 2012 at 18:27

1 Answer 1

1
bool ViewBag.addMerchantTypeRef = MerchantAdministrator.Models.MerchantAdminProduction.MerchantTypeRef.addMerchantTypeRef(merchantTypeRef);

Can you please tell me is this "merchantTypeRef" or "merchantTypeRefId"? Because merchantTypeRefId is what read by the first line and the same value will need to be passed when you call Model. If that doesn't work, can you please try with "FormCollection"?

Sign up to request clarification or add additional context in comments.

1 Comment

I updated it some more..i figure that i need to do a request to grab information from the fields.. I set the attributes.. I want to make an object can you help me.. need object to pass as my parameter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.