public object Upload()
        {
            HttpPostedFile file = HttpContext.Current.Request.Files["file"];

            if (file == null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "No file specified."));
            }

            if (file.ContentType != "application/octet-stream" || !file.FileName.ToLower().EndsWith(".csv"))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Specified file must be a CSV file."));
            }

            RedirectsProviderFile pfile = new RedirectsProviderFile(new HttpPostedFileWrapper(file));

            Dictionary <string, string> body = new Dictionary <string, string>();

            foreach (string key in HttpContext.Current.Request.Form.Keys)
            {
                body[key] = HttpContext.Current.Request.Form[key];
            }

            return(new RedirectsImportService().Import(pfile, CsvImportOptions.FromDictionary(body)));
        }
 public object Import(RedirectsProviderFile file, Dictionary <string, string> options)
 {
     return(Import(file, CsvImportOptions.FromDictionary(options)));
 }