I'm new to ASP.NET and i'd be so grateful if someone could help. I have my file input:
<form action="NewProject.cshtml" method="post" enctype="multipart/form-data">
<fieldset>
  <legend> Upload Image </legend>
  <label for="Image">Image</label>
  <input type="file" name="Image" id ="filename"/>
  <br/>
  <input type="submit" value="Upload" id="Add" />
</fieldset>
To upload image i use:
@{  WebImage photo = null;
var newFileName = "";
var imagePath = "";
if(IsPost){
    photo = WebImage.GetImageFromRequest();
    if(photo != null){
        newFileName = Guid.NewGuid().ToString() + "_" +
            Path.GetFileName(photo.FileName);
        imagePath = @"Images\" + newFileName;
        photo.Save(@"~\" + imagePath);
//an attempt
       PoleInvestProject.Models.Project project = new PoleInvestProject.Models.Project();
            project.Image = imagePath; //storing in model property Image
        }
    }
}
And now i need to get the path of the image from there and associate it with my model, which has the property public string Image { get; set; }. I want to store this file path in my database by DBContext context. 
  context.Projects.Add(new Project()
            {
                Image = model.Image
            });
            context.SaveChanges();
But this gives me NULL, there's nothing in my database table for Projects.
What am I doing wrong?
Thanks in advance!
 
    