c# - How would I do this the best way? -


i got viewmodel following attributes:

int balance int withdrawamount 

a view of mine in asp.net mvc4 application lets user withdraw money balance. when page accessed through request users balance , pass view through withdrawviewmodel displaying user - in model withdrawamount since user haven't specified amount withdraw yet.

the user enters desired amount withdraw , submits post request sending withdraw amount.

now bind withdrawamount withdrawviewmodel again in order automatically check if modelstate valid (is amount above 0).

finally withdraw amount etc.

the thing wanna know if there's better way accomplish this? me seems foolish use same viewmodel when values differ (either balance in model or withdrawamount in model) - virtually making them 2 different models.

can in better way?

if need withdrawamount, have controller action method take int parameter.

[httppost] [authorize] public viewresult mymethod(int withdrawamount){ ... } 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -