如何将Windows Phone应用程序(照片上传)连接到此Web服务(ASP.NET,WCF)?

时间:2014-04-23 11:06:47

标签: asp.net wcf windows-phone

您好我有这个Web服务http://cloudinvoice.azurewebsites.net/Invoice,我想要做的就是将它连接到我的Windows Phone照片上传应用程序。有什么建议?

*。SVC

[ServiceBehavior(
    ConcurrencyMode = ConcurrencyMode.Multiple,
    InstanceContextMode = InstanceContextMode.Single
)]
public class InvoiceSvc : IInvoiceSvc
{  
    public void UploadInvoice(InvoiceImg invoice)
    {

        using (InvoiceContext db = new InvoiceContext())
        {   
            Invoice dbinv = new Invoice();
            dbinv.Name = invoice.Name;
            dbinv.Surname = invoice.Surname;
            dbinv.shotDate = invoice.ShotDate;
            dbinv.uploadDate = DateTime.Now;
            dbinv.imgData = invoice.ImgData;

            db.Invoices.Add(dbinv);
            db.SaveChanges();
        }
    }
}
}

* CS

[ServiceContract]
public interface IInvoiceSvc
{
    [OperationContract]
    void UploadInvoice(InvoiceImg invoice);
}

[DataContract]
public class InvoiceImg
{
    [DataMember]
    public string Name { get; set; }
    [DataMember]
    public string Surname { get; set; }
    [DataMember]
    public DateTime ShotDate { get; set; }
    [DataMember]
    public byte[] ImgData { get; set; }
}
}

0 个答案:

没有答案