public IHttpActionResult MobileTransaction(string module, [FromBody] object mobileTransaction)
        {
            string token  = Request.Headers.GetValues("Authorization").FirstOrDefault();
            var    result = CommonMethods.AuthenticateWebAPI(token);

            if (result != WebAPIEnums.AuthenticationStatus.OK)
            {
                return(Json(CommonMethods.GetAutheticationError(result)));
            }
            else if (result == WebAPIEnums.AuthenticationStatus.OK && module == "mobiletransactions")
            {
                try
                {
                    var transaction = JsonConvert.DeserializeObject <MobileTransactionAPIModel>(mobileTransaction.ToString());

                    IMobileTransactionRepository mobileRepo = new MobileTransactionRepository();
                    mobileRepo.SaveMobileTransaction(transaction);

                    /*string path = AppDomain.CurrentDomain.BaseDirectory + "/Uploads";
                     * if (!Directory.Exists(path))
                     *  Directory.CreateDirectory(path);
                     *
                     * var provider = new MultipartFormDataStreamProvider(path);
                     * await Request.Content.ReadAsMultipartAsync(provider);
                     * var transaction = GetMobileTransactionValues(provider);*/
                }
                catch (Exception ex)
                {
                    return(BadRequest("Failed"));
                }
            }

            return(Json("Success"));
        }
        public IHttpActionResult GetModule(string module)
        {
            //var model = new ResponseContentModel<List<T>>();

            string token  = Request.Headers.GetValues("Authorization").FirstOrDefault();
            var    result = CommonMethods.AuthenticateWebAPI(token);

            if (result != WebAPIEnums.AuthenticationStatus.OK)
            {
                return(Json(CommonMethods.GetAutheticationError(result)));
            }
            else
            {
                if (module == WebAPIEnums.Module.inventory.ToString())
                {
                    var model = new ResponseContentModel <List <ProductAPIModel> >();
                    IProductRepository productRepo = new ProductRepository();

                    model.rows    = productRepo.GetProductsMobile();
                    model.total   = model.rows.Count.ToString();
                    model.key     = "id";
                    model.control = new Control {
                        page = "1", order = "asc", sort = "", limit = ""
                    };
                    return(Json(model));
                }
                else if (module == WebAPIEnums.Module.location.ToString())
                {
                    var model = new ResponseContentModel <List <LocationAPIModel> >();
                    ILocationRepository locRepo = new LocationRepository();
                    model.rows    = locRepo.GetLocationsMobile();
                    model.total   = model.rows.Count.ToString();
                    model.key     = "id";
                    model.control = new Control {
                        page = "1", order = "asc", sort = "", limit = ""
                    };
                    return(Json(model));
                }
                else if (module == WebAPIEnums.Module.supplier.ToString())
                {
                    var model = new ResponseContentModel <List <SupplierAPIModel> >();
                    IClientRepository clientRepo = new ClientRepository();
                    model.rows    = clientRepo.GetSuppliersMobile();
                    model.total   = model.rows.Count.ToString();
                    model.key     = "id";
                    model.control = new Control {
                        page = "1", order = "asc", sort = "", limit = ""
                    };
                    return(Json(model));
                }
                else if (module == WebAPIEnums.Module.users.ToString())
                {
                    var             model    = new ResponseContentModel <List <UserAPIModel> >();
                    IUserRepository userRepo = new UserRepository();
                    model.rows    = userRepo.GetUsersMobile();
                    model.total   = model.rows.Count.ToString();
                    model.key     = "id";
                    model.control = new Control {
                        page = "1", order = "asc", sort = "", limit = ""
                    };
                    return(Json(model));
                }
            }

            return(Json(CommonMethods.GetAutheticationError(WebAPIEnums.AuthenticationStatus.FAILED)));
        }