Esempio n. 1
0
        public void Create(ref DtoClient dtoClient)
        {
            var model     = dtoClient.ToRepository();
            var address   = dtoClient.Addresses.Where(i => i.Id == 0);
            var insertdId = Insert(model, "Client");
            var addresses = dtoClient.Addresses.Where(i => i.Id == 0).Select(i => i.ToRepository(insertdId));

            Insert(addresses, "Address");
            dtoClient.Id        = insertdId;
            dtoClient.Addresses = GetAllAddress(dtoClient.Token);
        }
Esempio n. 2
0
        public void UpdateClient(ref DtoClient dtoClient)
        {
            var model = dtoClient.ToRepository();

            var dbClient = this.GetClient(dtoClient.Token);

            model.Id = dbClient.Id;

            if (model.PasswordHash == null)
            {
                model.PasswordHash = dbClient?.PasswordHash;
            }

            this.Update(model, "Client");
        }