public HttpResponseMessage CreateCustomer(HttpRequestMessage request, [FromBody] CustomerMaintenanceDTO customerDTO)
        {
            TransactionalInformation transaction;

            CustomerMaintenanceViewModel customerMaintenanceViewModel = new CustomerMaintenanceViewModel();

            if (!ModelState.IsValid)
            {
                var errors = ModelState.Errors();
                customerMaintenanceViewModel.ReturnMessage = ModelStateHelper.ReturnErrorMessages(errors);
                customerMaintenanceViewModel.ValidationErrors = ModelStateHelper.ReturnValidationErrors(errors);
                customerMaintenanceViewModel.ReturnStatus = false;
                var badresponse = Request.CreateResponse<CustomerMaintenanceViewModel>(HttpStatusCode.BadRequest, customerMaintenanceViewModel);
                return badresponse;
            }

            Customer customer = new Customer();

            ModelStateHelper.UpdateViewModel(customerDTO, customer);

            CustomerApplicationService customerApplicationService = new CustomerApplicationService(customerDataService);
            customerApplicationService.CreateCustomer(customer, out transaction);

            customerMaintenanceViewModel.Customer = customer;
            customerMaintenanceViewModel.ReturnStatus = transaction.ReturnStatus;
            customerMaintenanceViewModel.ReturnMessage = transaction.ReturnMessage;
            customerMaintenanceViewModel.ValidationErrors = transaction.ValidationErrors;

            if (transaction.ReturnStatus==false)
            {
                var badresponse = Request.CreateResponse<CustomerMaintenanceViewModel>(HttpStatusCode.BadRequest, customerMaintenanceViewModel);
                return badresponse;
            }
            else
            {
                var response = Request.CreateResponse<CustomerMaintenanceViewModel>(HttpStatusCode.Created, customerMaintenanceViewModel);
                return response;
            }
        }
 public ActionResult EditCustomer(string customerID)
 {
     CustomerMaintenanceViewModel customerMaintenanceViewModel = new CustomerMaintenanceViewModel();
     customerMaintenanceViewModel.Customer.CustomerID = new Guid(customerID);
     return View("CustomerMaintenance", customerMaintenanceViewModel);
 }
        public HttpResponseMessage GetCustomerMaintenanceInformation(HttpRequestMessage request,Guid customerID)
        {
            TransactionalInformation customerTransaction;
            TransactionalInformation paymentTransaction;

            CustomerMaintenanceViewModel customerMaintenanceViewModel = new CustomerMaintenanceViewModel();

            CustomerApplicationService customerApplicationService = new CustomerApplicationService(customerDataService);

            if (customerID != Guid.Empty)
            {
                Customer customer = customerApplicationService.GetCustomerByCustomerID(customerID, out customerTransaction);
                customerMaintenanceViewModel.Customer = customer;
                customerMaintenanceViewModel.ReturnStatus = customerTransaction.ReturnStatus;
                customerMaintenanceViewModel.ReturnMessage = customerTransaction.ReturnMessage;
            }

            List<PaymentType> paymentTypes = customerApplicationService.GetPaymentTypes(out paymentTransaction);
            customerMaintenanceViewModel.PaymentTypes = paymentTypes;
            if (paymentTransaction.ReturnStatus==false)
            {
                customerMaintenanceViewModel.ReturnStatus = paymentTransaction.ReturnStatus;
                customerMaintenanceViewModel.ReturnMessage = paymentTransaction.ReturnMessage;
            }

            if (customerMaintenanceViewModel.ReturnStatus == true)
            {
                var response = Request.CreateResponse<CustomerMaintenanceViewModel>(HttpStatusCode.OK, customerMaintenanceViewModel);
                return response;
            }

            var badResponse = Request.CreateResponse<CustomerMaintenanceViewModel>(HttpStatusCode.BadRequest, customerMaintenanceViewModel);
            return badResponse;
        }
 public ActionResult CustomerMaintenance()
 {
     CustomerMaintenanceViewModel customerMaintenanceViewModel = new CustomerMaintenanceViewModel();
     customerMaintenanceViewModel.Customer.CustomerID = Guid.Empty;
     return View("CustomerMaintenance", customerMaintenanceViewModel);
 }