Esempio n. 1
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            string result = project.SaveProject(project);

            if (result.Contains("Success"))
            {
                this.Frame.Navigate(typeof(ProjectsPage),
                                    customer.GetCustomer(project.CustomerId));
            }
        }
Esempio n. 2
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (NameTextBox.Text == "")
            {
                MessageDialog msgDialog = new MessageDialog("Enter Project name");
                //OK Button

                //Show message
                msgDialog.ShowAsync();
            }
            else if (DescriptionTextBox.Text == "")
            {
                MessageDialog msgDialog = new MessageDialog("Enter Description ");
                //OK Button

                //Show message
                msgDialog.ShowAsync();
            }
            else if (DueDateTextBox.Text == "")
            {
                MessageDialog msgDialog = new MessageDialog("Enter Date ");
                //OK Button

                //Show message
                msgDialog.ShowAsync();
            }

            else
            {
                string result = project.SaveProject(project);
                if (result.Contains("Success"))
                {
                    this.Frame.Navigate(typeof(ProjectsPage),
                                        customer.GetCustomer(project.CustomerId));
                }
            }
        }
        public IHttpActionResult Create(CustomerViewModel model)
        {
            if (
                string.IsNullOrEmpty(model.customerName) ||
                string.IsNullOrEmpty(model.contactName) ||
                (model.cnpj == 0 || model.cnpj.ToString().Length < 14)
                )
            {
                return(BadRequest());
            }

            try {
                var svc         = new CustomerAppSvcGeneric();
                var newCustomer = svc.Create(model.GetCustomer());

                return(Ok(newCustomer));
            }
            catch (Exception e) {
                return(InternalServerError(e));
            }
        }