Beispiel #1
0
        public ActionResult GetUserByID(int _userId)
        {
            BO_Users obj = new BussinessObject.BO_Users();

            obj = BL_Users.GetUserByID(_userId);
            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
 public static BO_Users GetUserByID(int userId)
 {
     using (AprosysAccountingEntities db = new AprosysAccountingEntities())
     {
         var      obj   = db.Users.Where(x => x.Id == userId).FirstOrDefault();
         BO_Users _user = new BussinessObject.BO_Users();
         if (obj != null && !string.IsNullOrEmpty(obj.UserName))
         {
             _user.id          = obj.Id;
             _user.lastName    = obj.LastName ?? "";
             _user.firstName   = obj.FirstName ?? "";
             _user.phone       = obj.Phone ?? "";
             _user.email       = obj.Email ?? "";
             _user.userId      = obj.UserName;
             _user.password    = obj.Password;
             _user.address     = obj.Address ?? "";
             _user.adminRights = obj.AdminRights ?? false;
         }
         return(_user);
     }
 }