Isaac Holyk

Isaac Holyk

  • NA
  • 5
  • 687

Adding an Image to my Strain Class

May 13 2017 10:19 PM
I just need a simple straight foward example of how to add an Image to the Local DB database in an ASP.NET MVC app with Identity. I just want a scaffolded Strain class veiws with create delete edit.  I know that I need to add a byte StrainImage in my strain class but from this point I am unsure how to procede.
 
public class Strain 
{
public string StrainId {get; set; } 
public string StrainName {get; set; }
public byte[] StrainImage {get; set; }
 }
 
From this point I am not sure what to add the the Strain Controller Post Method
 I know that I need to open up use a HTTPPOSTEDFILEBASE , and open up a byte stream with a new stream reader.
Do I need to go as far as creating a StrainVeiwModel and a StrainDataContex
Could someone please help.