Esempio n. 1
0
        public static async Task <Client> CustomerMove(MovedClientData movedClient)
        {
            // Get customer collection
            var clients = _db.GetCollection <DBClient>("clients");
            var client  = clients.FindOne(x => x.Id.Equals(int.Parse(movedClient.CustomerKey)));

            client.Name          = movedClient.Name;
            client.Propertyunit  = movedClient.PropertyUnit;
            client.Streetaddress = movedClient.StreetAddress;
            client.Description   = movedClient.Description;
            client.Primary       = movedClient.Primary;
            client.Secondary1    = movedClient.Secondary1;
            client.Secondary2    = movedClient.Secondary2;

            var bossIDCustomer = new Client();

            if (clients.Update(client))
            {
                var allAccesspoints =
                    client.PrimaryAccessPoints.Concat(client.Secondary1AccessPoints)
                    .Concat(client.Secondary2AccessPoints)
                    .Select(x => new BossIDWS.Vendor.REST.ReturnObjects.AccessPoint {
                    name = x.name
                }).ToList();

                bossIDCustomer = new Client
                {
                    customerkey    = client.Id.ToString(),
                    AccessPoints   = allAccesspoints,
                    installationid = client.InstallationID
                };
            }

            return(await Task.FromResult(bossIDCustomer));
        }
Esempio n. 2
0
        public async Task <RO <Client> > CustomerMove([FromBody] MovedClientData movedClient)
        {
            var ro = new RO <Client>();

            var result = await VendorDL.CustomerMove(movedClient);

            if (result != null)
            {
                ro.ReturnCode  = 0;
                ro.ReturnValue = result;
            }
            else
            {
                ro.ReturnCode = 100;
            }
            return(ro);
        }