Beispiel #1
0
        public void DeleteData(ModelNotifiedForOrderDetails modelNotifiedForOrderDetails, out string error)
        {
            OrderDetailsGenericREST OrderDetailsGenericREST = new OrderDetailsGenericREST(wpfConfig);
            DeleteOrderDetailsView  deleteOrderDetailsView  = new DeleteOrderDetailsView();

            Cloner.CopyAllTo(typeof(ModelNotifiedForOrderDetails), modelNotifiedForOrderDetails, typeof(DeleteOrderDetailsView), deleteOrderDetailsView);
            OrderDetailsGenericREST.Delete(deleteOrderDetailsView, out error);
        }
Beispiel #2
0
        public IActionResult Delete(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;

                RESTOrderDetailsDB     rESTOrderDetailsDB = new RESTOrderDetailsDB(base.RESTConfig);
                DeleteOrderDetailsView viewToDelete       = rESTOrderDetailsDB.TryParse <DeleteOrderDetailsView>(GeneralBodyPost, out restExceptionError);
                if (restExceptionError != null)
                {
                    CreatedResult errorResult = helperRestError.GetError412_PreConditionFailed(transactionID, restExceptionError.ExceptionMessage, restExceptionError.InternalMessage, "OrderDetails/Insert");
                    return(errorResult);
                }

                rESTOrderDetailsDB.TryDelete(viewToDelete, out restExceptionError);
                if (restExceptionError != null)
                {
                    CreatedResult errorResult = helperRestError.GetError500_InternalServerError(transactionID, restExceptionError.ExceptionMessage, restExceptionError.InternalMessage, "OrderDetails/GetAll");
                    return(errorResult);
                }

                resultContainer.ReportPostHeader.Message = "Success";
                HttpResponseMessage httpResponseMessage = new HttpResponseMessage();
                httpResponseMessage.StatusCode = System.Net.HttpStatusCode.OK;
                CreatedResult createdResult = new CreatedResult("OrderDetails/Delete", httpResponseMessage);
                createdResult.Value      = resultContainer;
                createdResult.StatusCode = 200;
                return(createdResult);
            }
            catch (Exception ex)
            {
                CreatedResult errorResult = helperRestError.GetError500_InternalServerError(transactionID, ex.Message, "x", "OrderDetails/Create");
                return(errorResult);
            }
        }
Beispiel #3
0
        public void TryDelete(DeleteOrderDetailsView viewToDelete, out RestExceptionError error)
        {
            error = null;
            OrderDetailsInfo dbViewToDelete = new OrderDetailsInfo();

            try
            {
                Cloner.CopyAllTo(typeof(DeleteOrderDetailsView), viewToDelete, typeof(OrderDetailsInfo), dbViewToDelete);
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.InternalMessage  = "Internal Error parsing data for (OrderDetails.TryDelete/Parsing)";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }

            try
            {
                OrderDetailsBsn bsn     = new OrderDetailsBsn(restConfig);
                string          dbError = null;
                bsn.Delete(dbViewToDelete, out dbError);
                if (dbError != null)
                {
                    error = new RestExceptionError();
                    error.InternalMessage  = "Internal Error Save data for [OrderDetails.TryDelete]";
                    error.ExceptionMessage = dbError;
                    error.SourceError      = RestExceptionError._SourceError.ServerSide;
                    error.StackTrace       = "";
                }
            }
            catch (Exception ex)
            {
                error = new RestExceptionError();
                error.InternalMessage  = "Internal Error Update data for [OrderDetails.TryDelete]";
                error.ExceptionMessage = ex.Message;
                error.SourceError      = RestExceptionError._SourceError.ServerSide;
                error.StackTrace       = ex.StackTrace;
            }
        }