title: How to save data through Orchard module?
body: <p>I'm new with orchard.</p>
  
  <p>To learn orchard module development, I am following documentation to try to create a commerce module.</p>
  
  <p>The module consists of product part and product type, which has product part.</p>
  
  <p>When I try to save data in following method:</p>
  
  <pre><code>public ActionResult Create(FormCollection input)
      {
          var product = contentManager.New&lt;ProductPart&gt;("Product");
          product.Description = input["Description"];
          product.Sku = input["Sku"];
          product.Price =Convert.ToDecimal(input["Price"]);
  
          if (!ModelState.IsValid)
          {
              return View(product);
          }
  
          contentManager.Create(product);
  
          return RedirectToAction("Index");
      }    
  </code></pre>
  
  <p>I am getting an error that specific cast is Invalid and <code>part(ContentPart)</code> is null.</p>
  
  <pre><code>public static T New&lt;T&gt;(this IContentManager manager, string contentType)
   where T : class, IContent {
          var contentItem = manager.New(contentType);
          if (contentItem == null)
              return null;
  
          var part = contentItem.Get&lt;T&gt;();
          if (part == null)
              throw new InvalidCastException();
  
          return part;
      }
  </code></pre>
  
  <p>I used content type Product and I have ProductRecord class for storage data, as below:</p>
  
  <pre><code>public class ProductRecord:ContentPartRecord
  {
     // public virtual int Id { get; set; }
  
  
      public virtual string Sku { get; set; }
  
  
      public virtual string Description { get; set; }
  
  
      public virtual decimal Price { get; set; }
  
  
  }
  
  
  
  public class ProductPart : ContentPart&lt;ProductRecord&gt;
  {
      /*
      public int Id
      {
          get { return Record.Id; }
          set{Record.Id = value;}
      }
      */
  
      [Required]
      public  string Sku
      {
          get { return Record.Sku; }
          set { Record.Sku = value; }
      }
  
      [Required]
      public  string Description 
      {
          get { return Record.Description; }
          set{ Record.Description = value;}
      }
  
      [Required]
      public  decimal Price 
      {
          get { return Record.Price; }
          set { Record.Price = value; }
      }
  
  
  }
  </code></pre>
  
  <p>Can anybody tell me what my problem is?</p>