/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Download(string id) { var book = db.Books.Find(new Guid(id)); if (book == null) { return(new HttpNotFoundResult()); } var extName = OpdsHelper.GetExtensionName(book.MimeType); return(new RangeFileResult(Request, HostingEnvironment.MapPath("~/App_Data/Uploaded/") + id + extName, book.Name + extName, book.MimeType)); }
public void GetExtensionNameTest() { var ext = OpdsHelper.GetExtensionName("text/plain"); Assert.AreEqual(".txt", ext); }