public static MyProfViewModel FromModel(PROF model)
    {
        var viewModel = new MyProfViewModel()
        {
            myprofID  = model.ID,
            myprofDes = model.DESCRIPTION
        };

        return(viewModel);
    }
示例#2
0
        public ActionResult <IEnumerable <UserProfiles> > GetUserProf()
        {
            var user = from us in _context.User
                       join uspr in _context.User_Profile
                       on us.idUser equals uspr.idUser into USPR
                       from usp in USPR.DefaultIfEmpty()
                       join pr in _context.Profile
                       on usp.idProfile equals pr.idProfile into PROF
                       from m in PROF.DefaultIfEmpty()
                       select new
            {
                us.idUser,
                us.Name,
                us.CPF,
                Type = m.Type
            };

            if (user == null)
            {
                return(NotFound());
            }

            return(Ok(user));
        }