public bool UploadImgBit(UploadImgB File) { try { return(true); } catch (Exception) { throw; } }
public string UploadImg(UploadImgB File) { string authHeader = WebOperationContext.Current.IncomingRequest.Headers["Authorization"]; if (HToken.check(authHeader)) { if (string.IsNullOrEmpty(File.Nombre) && string.IsNullOrEmpty(File.Imagen)) { CustomErrorDetail customError = new CustomErrorDetail(404, "Dato Faltante", "El nombre y la imagen son obligatorios"); throw new WebFaultException <CustomErrorDetail>(customError, HttpStatusCode.NotFound); } HUploadImgeBit.ImagesSys(File.Imagen, File.Nombre, "/Recursos/"); return(JsonConvert.SerializeObject(new { Respuesta = _me.UploadImgBit(File) })); } WebOperationContext.Current.OutgoingResponse.Headers.Add("WWW-Authorization: Token realm=\"wsuploadbit\""); throw new WebFaultException(HttpStatusCode.Unauthorized); }