javascript - Angularjs Entity Framework -



javascript - Angularjs Entity Framework -

i have 2 models :

public class usermodel { public long userid { get; set; } public string name { get; set; } public ienumerable<numbermodel> numbers { get; set; } } public class numbermodel { public long numberid { get; set; } public string num { get; set; } public long userid { get; set; } public usermodel user { get; set; } }

relationship between tables 1 many, how can display info using entity framework , angularjs using foreign keys , : |name| number|.

this code 1 table :

controler: public ihttpactionresult getusers() { using (contactentities ocontext = new contactentities()) { var query = in ocontext.user select a; ilist<usermodel> list = query.select(x => new usermodel { name=x.name, userid=x.userid numbers????? }).tolist(); } }; homecoming ok(list); } } <table class="table table-striped table-condensed table-hover"> <thead> <th>todo</th> <th>priority</th> <th>todo</th> <th>priority</th> </thead> <tbody> <tr ng-repeat="item in items"> <td>{{item.userid}}</td> <td>{{item.name}}</td> <td>{{item.numberid}}</td> <td>{{item.num}}</td> </tr> </tbody> </table> var proba = angular.module("proba", ["ngresource", "ngroute"]). config(function ($routeprovider) { $routeprovider. when('/', { controller: listctrl, templateurl: 'list.html' }). otherwise({ redirectto: '/' }); }); proba.factory('todo' ,function ($resource) { homecoming $resource('/api/user/:id', { id: '@id' }, { update: { method: 'put' } }); }); var listctrl = function ($scope, $location, todo,num) { $scope.items = todo.query(); };

ilist<usermodel> list = query.select(x => new usermodel { name=x.name, userid=x.userid numbers=x.numbers.count() }).tolist();

javascript

Comments

Popular posts from this blog

c# - ASP.NET MVC Sequence contains no matching element -

java - Parsing XML, skip certain tags -

rest - How to invalidate user session on inactivity in a stateless server? -