What data type can receive data table inside class ? RRS feed

  • Question

  • Problem

    what datatype can receive data table inside class as branchid and branchname 
    and how to receive ? 

    I have class Users for login as following :

    public class Users
           public string UserName { get; set; }
           public string Password { get; set; }
           public string MessageStatus { get; set; }
           public int StatusCode { get; set; }
           public string StatusText { get; set; }
           public string IpAddress { get; set; }
           public string BrowserInfo { get; set; }
           public ??? branches_datatable {get;set;}

    i need to get property from class can have the values of branches data table but i dont know how to write datatype inside class ?
    and how to receive data table ?

    datatable branches have the following
    branchid  branchname
    1         englandbranch
    2         francebranch


    What I have tried:

                int LoginStatus = _AuthunticateService.PostUserLogin(user.UserName,user.Password ,out DataTable Branches,out string errorMessage, out int statusCode);
               if(LoginStatus == 1)
                    user.StatusCode = statusCode;
                    user.StatusText = "failed";
                    user.MessageStatus = "login failed, incorrect username or password";
    Datatable dtGetBranches = DataAccess.ExecuteDataTable(
    user.???? branches_datatable=dtGetBranches 
    // how to assign data table to property of class here and what property for class data table 
    the user object will convert to json file after assign properties as statuscode,statustext,messagstatus,dtgetbranches

    Friday, August 30, 2019 11:54 PM


  • Branches_datatable property type would be Datatable, although myself I would use List<t> and a custom class with public properties.

    Saturday, August 31, 2019 3:13 AM