Ejemplo n.º 1
0
        // GET api/<controller>
        public IEnumerable <FriendModel> Get()
        {
            var friends = _dbContext.GetFriends();
            var entity  = _mapper.Map <Friend, FriendModel>(friends);

            return(entity);
        }
Ejemplo n.º 2
0
        // GET: Friend
        public ActionResult Index()
        {
            var friends     = entities.GetFriends();
            var friendsList = new List <FriendModel>();

            friendsList.AddRange(friends.Select(person =>
                                                new FriendModel
            {
                FriendID   = person.FriendId,
                FriendName = person.FriendName,
                Place      = person.Place
            }
                                                )
                                 );
            if (friendsList.Count != 0)
            {
                return(View(friendsList));
            }
            else
            {
                return(View());
            }
        }