Search Results

Search found 2 results on 1 pages for 'mediaslayer'.

Page 1/1 | 1 

  • What is the response on a REST call where a field is not valid?

    - by MediaSlayer
    There are many questions on StackOverflow about this, but no definitive answer. I have a REST resource where an entity's field, ProductId, is sent. If the ProductId passed is invalid, what kind of response would you do? I want to send the right response code plus information to the requester on what they can do to fix it. Initial thoughts were 422 with the body containing the list of errors in JSON/XML format. Maybe like this (JSON): [ { FieldName : "ProductId", ErrorCode : "M123", Description : "Product Not Found" }, { FieldName : "Quantity", ErrorCode : "Q001", Description : "Quantity cannot be more than 100" } ] Thoughts?

    Read the article

  • Why input elements don't render the value passed in ASP.Net MVC?

    - by MediaSlayer
    This post asks this question but doesn't really give an answer, so I thought I would ask the question differently. I have a page that renders a hidden value from the model: <%=Html.Hidden("myName", model.myValue) %> Since I am passing a value in the value parameter, you would think it would output that value, but it doesn't. The code for rendering input fields has the following: string attemptedValue = (string)htmlHelper.GetModelStateValue(name, typeof(string)); tagBuilder.MergeAttribute("value", attemptedValue ?? ((useViewData) ? htmlHelper.EvalString(name) : valueParameter), isExplicitValue); Basically, if the ModelState (which contains posted values) contains a value for the "name" passed, it will use that value instead of your passed value to the helper method. In my case, I updated the model and my updated value wasn't outputted. If I pass a value to a method, I expect that value to be rendered. Am I missing something in this design or is it just wrong?

    Read the article

1