Beispiel #1
0
        //Inventory attachement upload
        public IHttpActionResult Post()
        {
            int inventoryAttachmentId = 0;

            try
            {
                InventoryAttachmentModel inventoryAttachmentModel = new InventoryAttachmentModel();
                var httpRequest            = HttpContext.Current.Request;
                HttpFileCollection uploads = HttpContext.Current.Request.Files;
                foreach (string file in httpRequest.Files)
                {
                    var docfiles   = new List <string>();
                    var postedFile = httpRequest.Files[file];
                    var filePath   = HttpContext.Current.Server.MapPath("~/InventoryImages/" + postedFile.FileName);
                    postedFile.SaveAs(filePath);
                    docfiles.Add(filePath);
                    string filePaths = filePath;
                    inventoryAttachmentModel.AttachmentPath = filePath;
                    inventoryAttachmentModel.FileName       = postedFile.FileName;
                    inventoryAttachmentId = _inventoryServices.saveAttachement(inventoryAttachmentModel);
                }
                return(Ok(ResponseUtil.GetResponse(true, inventoryAttachmentId, null)));
            }

            catch (WebException ex)
            {
                var response = new FailureResponse()
                {
                    Message    = Messages.FAILURE_MESSAGE_CREATEUSER,
                    StatusCode = 400
                };
                return(Content(HttpStatusCode.BadRequest, ResponseUtil.GetResponse(false, null, response)));
            }
        }
Beispiel #2
0
 public virtual IHttpActionResult getSalesUserById(int userID)
 {
     try
     {
         var customerData = _salesUserServices.getSalesUserById(userID);
         return(Ok(ResponseUtil.GetResponse(true, customerData, null)));
     }
     catch (Exception ex)
     {
         var response = new FailureResponse()
         {
             Message    = Messages.FAILURE_MESSAGE_GETALLUSER,
             StatusCode = 400
         };
         return(Content(HttpStatusCode.BadRequest, ResponseUtil.GetResponse(false, null, response)));
     }
 }
 public virtual IHttpActionResult updateOrderStatus(long orderId, long statusId)
 {
     try
     {
         var updateData = _orderStatusServices.updateOrderStatus(orderId, statusId);
         return(Ok(ResponseUtil.GetResponse(true, updateData, null)));
     }
     catch (Exception ex)
     {
         var response = new FailureResponse()
         {
             Message    = Messages.FAILURE_MESSAGE_GETALLUSER,
             StatusCode = 400
         };
         return(Content(HttpStatusCode.BadRequest, ResponseUtil.GetResponse(false, null, response)));
     }
 }
 public virtual IHttpActionResult Get(string status)
 {
     try
     {
         var customerData = _orderStatusServices.getAllOrders(status);
         return(Ok(ResponseUtil.GetResponse(true, customerData, null)));
     }
     catch (Exception ex)
     {
         var response = new FailureResponse()
         {
             Message    = Messages.FAILURE_MESSAGE_GETALLUSER,
             StatusCode = 400
         };
         return(Content(HttpStatusCode.BadRequest, ResponseUtil.GetResponse(false, null, response)));
     }
 }
Beispiel #5
0
        public virtual async Task <IHttpActionResult> Put(SalesUserModel salesUserModel)
        {
            try
            {
                var updateUser = await _salesUserServices.updateSalesUserAsync(salesUserModel);

                return(Ok(ResponseUtil.GetResponse(true, updateUser, null)));
            }
            catch (Exception ex)
            {
                var response = new FailureResponse()
                {
                    Message    = Messages.FAILURE_MESSAGE_CREATEUSER,
                    StatusCode = 400
                };
                return(Content(HttpStatusCode.BadRequest, ResponseUtil.GetResponse(false, null, response)));
            }
        }
Beispiel #6
0
        //Update Inventory
        public virtual async Task <IHttpActionResult> Post(InventoryModel inventoryModel)
        {
            try
            {
                var createInventory = await _inventoryServices.createInventoryAsync(inventoryModel);

                return(Ok(ResponseUtil.GetResponse(true, createInventory, null)));
            }
            catch (Exception ex)
            {
                var response = new FailureResponse()
                {
                    Message    = Messages.FAILURE_MESSAGE_CREATEUSER,
                    StatusCode = 400
                };
                return(Content(HttpStatusCode.BadRequest, ResponseUtil.GetResponse(false, null, response)));
            }
        }
        public virtual async Task <IHttpActionResult> Put(int CustomerId, string FirstName, string LastName, string EmailAddress, long MobileNumber, string Address)
        {
            try
            {
                var updateUser = await _userServices.updateUserAsync(CustomerId, FirstName, LastName, EmailAddress, MobileNumber, Address);

                return(Ok(ResponseUtil.GetResponse(true, updateUser, null)));
            }
            catch (Exception ex)
            {
                var response = new FailureResponse()
                {
                    Message    = Messages.FAILURE_MESSAGE_CREATEUSER,
                    StatusCode = 400
                };
                return(Content(HttpStatusCode.BadRequest, ResponseUtil.GetResponse(false, null, response)));
            }
        }
        public virtual async Task <IHttpActionResult> Post(OrderStatusModel orderStatusModel)
        {
            try
            {
                var createUser = await _orderStatusServices.createOrderAsync(orderStatusModel);

                return(Ok(ResponseUtil.GetResponse(true, createUser, null)));
            }
            catch (Exception ex)
            {
                var response = new FailureResponse()
                {
                    Message    = Messages.FAILURE_MESSAGE_CREATESALESUSER,
                    StatusCode = 400
                };
                return(Content(HttpStatusCode.BadRequest, ResponseUtil.GetResponse(false, null, response)));
            }
        }
Beispiel #9
0
        public IHttpActionResult DeleteFile(long attachementId)
        {
            var deleteattachement = _inventoryServices.DeleteFile(attachementId);

            return(Ok(ResponseUtil.GetResponse(true, deleteattachement, null)));
        }