I have my model:
public class Produto
{
public int Id {get;set;}
public string Nome {get;set;}
public byte[] Imagem {get;set;}
}
How do I deal with it if it is "removing" or is it Editing (Replacing) the Product image? In my View:
@Html.TextBoxFor(model => model.ImagemUpload, new { type = "file", @class = "filestyle form-control", @data_size = "sm" })
In my ViewModel I have the property
public HttpPostedFileBase ImagemUpload{ get; set; }
Which I check in the controller
if(model.ImagemUpload!= null)
{
Tem Imagem então salva/Edita
}
Here in Edit, New, it works, but how do I know when it's removing? So if it is removing the model.ImageUpload will come Null, and I need to delete the value that is with Byte [] in my table.