Ejemplo n.º 1
0
        public void AddData(ModelNotifiedForCustomerCustomerDemo modelNotifiedForCustomerCustomerDemo, out string error)
        {
            CustomerCustomerDemoGenericREST CustomerCustomerDemoGenericREST = new CustomerCustomerDemoGenericREST(wpfConfig);
            CreateCustomerCustomerDemoView  createCustomerCustomerDemoView  = new CreateCustomerCustomerDemoView();

            Cloner.CopyAllTo(typeof(ModelNotifiedForCustomerCustomerDemo), modelNotifiedForCustomerCustomerDemo, typeof(CreateCustomerCustomerDemoView), createCustomerCustomerDemoView);
            CustomerCustomerDemoGenericREST.Insert(createCustomerCustomerDemoView, out error);
        }
Ejemplo n.º 2
0
        public IActionResult Create(GeneralBodyPost GeneralBodyPost)
        {
            string          transactionID   = Guid.NewGuid().ToString();
            string          currentURL      = this.Request.Method;
            HelperRestError helperRestError = new HelperRestError();
            HelperHTTPLog   helperHTTPLog   = new HelperHTTPLog(HelperHTTPLog.WhatToLog.All);

            try
            {
                GeneralPostResponse resultContainer = new GeneralPostResponse();
                resultContainer.ReportPostHeader.TransactionID = transactionID;
                RestExceptionError restExceptionError = null;

                RESTCustomerCustomerDemoDB     rESTCustomerCustomerDemoDB = new RESTCustomerCustomerDemoDB(base.RESTConfig);
                CreateCustomerCustomerDemoView viewToInclude = rESTCustomerCustomerDemoDB.TryParse <CreateCustomerCustomerDemoView>(GeneralBodyPost, out restExceptionError);
                if (restExceptionError != null)
                {
                    CreatedResult errorResult = helperRestError.GetError412_PreConditionFailed(transactionID, restExceptionError.ExceptionMessage, restExceptionError.InternalMessage, "CustomerCustomerDemo/Insert");
                    return(errorResult);
                }

                rESTCustomerCustomerDemoDB.TryInclude(viewToInclude, out restExceptionError);
                if (restExceptionError != null)
                {
                    CreatedResult errorResult = helperRestError.GetError500_InternalServerError(transactionID, restExceptionError.ExceptionMessage, restExceptionError.InternalMessage, "CustomerCustomerDemo/GetAll");
                    return(errorResult);
                }

                resultContainer.ReportPostHeader.Message = "Success";
                HttpResponseMessage httpResponseMessage = new HttpResponseMessage();
                httpResponseMessage.StatusCode = System.Net.HttpStatusCode.Created;
                CreatedResult createdResult = new CreatedResult("CustomerCustomerDemo/Create", httpResponseMessage);
                createdResult.Value = resultContainer;
                return(createdResult);
            }
            catch (Exception ex)
            {
                CreatedResult errorResult = helperRestError.GetError500_InternalServerError(transactionID, ex.Message, "x", "CustomerCustomerDemo/Create");
                return(errorResult);
            }
        }
Ejemplo n.º 3
0
        public void TryInclude(CreateCustomerCustomerDemoView viewToInclude, out RestExceptionError error)
        {
            error = null;
            CustomerCustomerDemoInfo dbViewToInclude = new CustomerCustomerDemoInfo();

            try
            {
                Cloner.CopyAllTo(typeof(CreateCustomerCustomerDemoView), viewToInclude, typeof(CustomerCustomerDemoInfo), dbViewToInclude);
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.InternalMessage  = "Internal Error parsing data for (CustomerCustomerDemo.TryInclude/Parsing)";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }

            try
            {
                CustomerCustomerDemoBsn bsn = new CustomerCustomerDemoBsn(restConfig);
                string dbError = null;
                bsn.InsertOne(dbViewToInclude, out dbError);
                if (dbError != null)
                {
                    error = new RestExceptionError();
                    error.InternalMessage  = "Internal Error Save data for [CustomerCustomerDemo.TryInclude/Save]";
                    error.ExceptionMessage = dbError;
                    error.SourceError      = RestExceptionError._SourceError.ServerSide;
                    error.StackTrace       = "";
                }
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.InternalMessage  = "Internal Error Save data for [CustomerCustomerDemo.TryInclude/Save]";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }
        }