I have a class user in my project and the model is user (to see the user) This user is on
using the system; Namespace ErgoSite Supplier Services View Models {Public Class Username {Public Good ID} (get; set;} public string full name {get; set;} public string name {get; set;} public string email {get} set;} public fulfillment status ; Set;} Public int role {get; set;} public guide supplement id {receipts; set;} public child actions Proposed (get; set;) public bull MailResendRequired {get; set;}}} < / Pre> and If I need to add in my controller check, ActionsAllowed
[HttpPost] public ActionResult Unlock (GUID ID) {var user = context.Users.Find (ID); if (user == Null) {Jason (CommandRelt.faller ("The user was not found, please refresh the grid and try again."));} CheckActionsAllowed = Context.Users.AsNoTracking ().} Select (E = New UserRow {Id = e.Id, ActionsAllowed = e.ActionsAllowed}; if (checkActionsAllowed == true) {user.Status = UserStatus.Active; Back Jason (CommandResult.Success (string.Format ("user {0} unlocked" Interpretation is. ", User.FullName)));} and return;} But I get the error Actions Valid = e. Actions allowed and and return;
Help me solve this problem. "itemprop =" text "> You have two problems:
Context.Users.AsNoTracking ( ) .Select (E => New UserRow {ActionsAllowed = E.ActionsAllowed}; Returns a list of objects, not an object. You have inquired from the above user, so I think you can just write:
if (user.ActionsAllowed) {user.Status = UserStatus.Active; Returned Json (CommandResult.Success ...);} The second problem is return; the statement method gives an action result, so you get something back Rana will be. For example returns Jason (Kmmandarilt. Feeler ( "Akshnelsd = Fotl"));
No comments:
Post a Comment