c# - use different api POST call with same uri. and want to use generated filename to go to azure table storage as entity -
i making asp.net web api want upload image blob , insert entity table in single api call single uri should able both post-operation not able that. tried assigning single "routeprefix" whole namespace. is there solution?
first post api call controller blob insertion
[routeprefix("api/upload")] public class blobscontroller : apicontroller { private readonly iblobservice _service = new blobservice(); [responsetype(typeof(list<blobuploadmodel>))] [httppost] public async task<ihttpactionresult> postblobupload() { try { if (!request.content.ismimemultipartcontent("form-data")) { return statuscode(httpstatuscode.unsupportedmediatype); } var result = await _service.uploadblobs(request.content); if (result != null && result.count > 0) { return ok(result); } return badrequest(); } catch (exception ex) { return internalservererror(ex); } } second post api call controller table insertion
public class playercontroller : apicontroller { private static string _connectionstring = ""; [httppost] // post api/player public string post(string skey, string srow, string passid, string jobuniqueid, string playerid, string charid, string frontfileload, string sidefileload, int priority) { string sresponse = ""; // create our player // create entity partition key sport , row // row should unique within partition playerentity _record = new playerentity(skey, srow); _record.passid = passid; _record.jobuniqueid = jobuniqueid; _record.playerid = playerid; _record.charid = charid; _record.priotiy = priority; _record.frontfileload = frontfileload; _record.sidefileload = sidefileload; //create storage account object. cloudstorageaccount storageaccount = cloudstorageaccount.parse(_connectionstring); // create table client. cloudtableclient tableclient = storageaccount.createcloudtableclient(); // retrieve reference table. cloudtable table = tableclient.gettablereference("player"); table.createifnotexists(); // create tableoperation object inserts customer entity. tableoperation insertoperation = tableoperation.insert(_record); try { // execute insert operation. table.execute(insertoperation); sresponse = "ok"; } catch (exception ex) { sresponse = "failed: " + ex.tostring(); } return sresponse; } second question my second question is- want use generated filename uploaded blobs go entity of tablestorage "frontfileload" , "sidefileload" , want upload 2 blobs @ same time , send file name table storage. how that?
this code saving filename , sending result
thanks in advance
Comments
Post a Comment