问题
I have this class TBEquipamento in my webservice :
public partial class TBEquipamento
{
public int idEquipamento { get; set; }
public int idTipoEquipamento { get; set; }
public Nullable<int> idLocalidade { get; set; }
public string NumSerie { get; set; }
public string TAG { get; set; }
public string Potencia_KVA { get; set; }
public Nullable<float> TensaoPrimaria_V { get; set; }
public Nullable<float> TensaoSecundaria_V { get; set; }
public Nullable<int> idFabricante { get; set; }
public Nullable<int> AnoFabricacao { get; set; }
public Nullable<float> Volume_L { get; set; }
public Nullable<int> idEqOperando { get; set; }
public Nullable<int> idSistemaRefrigeracao { get; set; }
public Nullable<int> idComutador { get; set; }
public Nullable<int> idTipoOleo { get; set; }
public Nullable<int> idSistemaPreservacao { get; set; }
public byte[] FotoEquipamento { get; set; }
}
}
And this function to POST in it:
// POST: função add equipamento
[HttpPost]
[Route("api/insertequipamento")]
[ResponseType(typeof(TBEquipamento))]
public async Task<IHttpActionResult> insertequipamento([FromBody] TBEquipamento addequipamento)
{
objapi.TBEquipamento.Add(addequipamento);
await objapi.SaveChangesAsync();
return Ok("confirmationSuccess");
}
The problem is when a pass a data to FotoEquipamento, I tried to pass a base64 and blob data to it from my Angularjs, but it doesn't work.
My image in angularjs is in my $scope.FotoEquipamento, and if I print it in console is: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4RDoRXhpZgAATU0AKg [...]'
Do you guys have any ideia of how can a POST that image? Thank you all for the attetion.
来源:https://stackoverflow.com/questions/41400016/image-base64-in-angularjs-to-c-sharp-varbinarymax