示例#1
0
        internal ClientDB InvMap(Client Client)
        {
            WebApiConfig.Logger.info("enter ClientsController->InvMap with id = " + Client.Id.ToString());

            if (Client == null)
            {
                WebApiConfig.Logger.warning("return from ClientsController->InvMap where Client==null");

                return(null);
            }
            ClientDB ClientDB = new ClientDB()
            {
                Id      = Client.Id,
                Name    = Client.Name,
                Surname = Client.Surname
            };
            string str = "";

            foreach (var ren in Client.RentingHistory)
            {
                str += ren.ToString() + "#";
            }
            ClientDB.RentingHistory = str;
            WebApiConfig.Logger.info("return  from ClientsController->InvMap with id = " + Client.Id.ToString());

            return(ClientDB);
        }
示例#2
0
        internal Client Map(ClientDB ClientDB)
        {
            WebApiConfig.Logger.info("enter ClientsController->Map with id = " + ClientDB.Id.ToString());

            if (ClientDB == null)
            {
                WebApiConfig.Logger.warning("return from ClientsController->Map ClientDB==null");

                return(null);
            }
            Client Client = new Client()
            {
                Id = ClientDB.Id, Name = ClientDB.Name, Surname = ClientDB.Surname
            };

            /* String[] str = ClientDB.RentingHistory.Split('#'); //NullPointer
             * foreach (var num in str)
             * {
             *   if (!num.Equals(""))
             *   {
             *       Client.RentingHistory.Add(int.Parse(num));
             *   }
             * }*/
            WebApiConfig.Logger.info("return from ClientsController->Map with id = " + ClientDB.Id.ToString());

            return(Client);
        }