コード例 #1
0
        public void CreateOrUpdate(ClientBindingModel model)
        {
            var element = _clientStorage.GetElement(new ClientBindingModel
            {
                ClientName    = model.ClientName,
                ClientSurname = model.ClientSurname,
                Login         = model.Login,
                Password      = model.Password,
                Mail          = model.Mail,
                Tel           = model.Tel
            });

            if (element != null && element.Id != model.Id)
            {
                throw new Exception("Уже есть клиент с такими данными");
            }
            if (model.Id.HasValue)
            {
                _clientStorage.Update(model);
            }
            else
            {
                _clientStorage.Insert(model);
            }
        }
コード例 #2
0
        public void CreateOrUpdate(ClientBindingModel model)
        {
            var element = _clientStorage.GetElement(new ClientBindingModel {
                Telephone = model.Telephone
            });

            if (element != null && element.Id != model.Id)
            {
                throw new Exception("Уже есть клиент с таким номером телефона");
            }
            if (model.Id.HasValue)
            {
                _clientStorage.Update(model);
            }
            else
            {
                _clientStorage.Insert(model);
            }
        }
コード例 #3
0
        public void CreateOrUpdate(ClientBindingModel model)
        {
            var element = _clientStorage.GetElement(new ClientBindingModel
            {
                Login = model.Login
            });

            if (element != null && element.Id != model.Id)
            {
                throw new Exception("Уже есть клиент с таким логином");
            }
            if (model.Id.HasValue)
            {
                _clientStorage.Update(model);
            }
            else
            {
                _clientStorage.Insert(model);
            }
        }
        public void CreateOrUpdate(ClientBindingModel model)
        {
            var element = _clientStorage.GetElement(new ClientBindingModel
            {
                Email = model.Email
            });

            if (element != null && element.Id != model.Id)
            {
                throw new Exception("Уже есть учётная запись с данной электронной почтой");
            }
            if (model.Id.HasValue)
            {
                _clientStorage.Update(model);
            }
            else
            {
                _clientStorage.Insert(model);
            }
        }
コード例 #5
0
ファイル: ClientLogic.cs プロジェクト: smutkaa/TaskTracker
        public void CreateOrUpdate(ClientBindingModel model)
        {
            var element = _clientStorage.GetElement(new ClientBindingModel
            {
                Name    = model.Name,
                Company = model.Company
            });

            if (element != null && element.Id != model.Id)
            {
                throw new Exception("Уже есть клиент");
            }
            if (model.Id.HasValue)
            {
                _clientStorage.Update(model);
            }
            else
            {
                _clientStorage.Insert(model);
            }
        }