0
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 handle it if it is "Removing" or is 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 on 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? Because if it is removing the model.Imagemupload will come Null, and I need to delete the value that is with Byte[] in my table.