Lukket

Fix Coding Problem for app (xamarin)

I am trying to make an API call from xamarin, this is my first Full mobile app calling restful API (.NetCore3.1) with a Angular WebApp. All other API calls from the xamarin app are working, The issue is I need to send a File with an object, file can be .doc .png etc.

[login to view URL] API Endpoint

public class FileProvider { public string GA { get; set; } public IList<IFormFile> Files { get; set; } } [HttpPost] [Route("[action]")] public ActionResult SubmitGrantApplication([FromForm] FileProvider fileProvider) { try { var ga = fileProvider; byte[] fileContent = null; var files = [login to view URL]() ? [login to view URL] : new FormFileCollection(); var grant = [login to view URL]<GrantApplication>([login to view URL]); ... } }

[login to view URL] Call made from the mobile app: This call is returning a 400 response with no clear indication why. I am trying to figure out why, And my postman skills aren't that great to convert the code to postman.

The error returned at #5.

::"Object reference not set to an instance of an object."

public class GrantService { public static async Task<GrantApplication> SubmitGrant(GrantApplication ga,string file, string FileName, StreamContent FileData) { Uri requestUri = new Uri($"{[login to view URL]}/grantapplication/SubmitGrantApplication"); try { var upfilebytes = [login to view URL](file); //using (HttpClient client = new HttpClient()) //{ // //MultipartFormDataContent content = new MultipartFormDataContent(); // //ByteArrayContent baContent = new ByteArrayContent(upfilebytes); // //StringContent GA = new StringContent([login to view URL](ga)); // //[login to view URL](baContent, "Files", FileName); // //[login to view URL](GA, "GA"); // //[login to view URL](content); // //var response = await [login to view URL](requestUri, content); // //[login to view URL](await [login to view URL]()); // //return ga; //} using (var formContent = new MultipartFormDataContent()) { [login to view URL] = "multipart/form-data"; // 3. Add the filename C:\\... + fileName is the path your file Stream fileStream = [login to view URL](file); [login to view URL](new StreamContent(fileStream), FileName, FileName); var payload = [login to view URL](ga); HttpContent content = new StringContent(payload, [login to view URL], "application/json"); [login to view URL](content, "GA"); using (var client = new HttpClient()) { // Bearer Token header if needed [login to view URL](new MediaTypeWithQualityHeaderValue("multipart/form-data")); try { // 4.. Execute the MultipartPostMethod var message = await [login to view URL](requestUri, formContent); // 5.a Receive the response var result = await [login to view URL](); [login to view URL](result); } catch (Exception ex) { // Do what you want if it fails. throw ex; } } } return ga; } catch(Exception ex) { [login to view URL](ex); return ga; } } }

Web System Angular API call

public SubmitGrantApplication(grantApplication){ [login to view URL] = [login to view URL]([login to view URL]("LoggedInUser")).memberID; [login to view URL] = [login to view URL]([login to view URL]("LoggedInUser")).clientID; [login to view URL] = new HttpHeaders({ 'Content-Type' : 'multipart/form-data' }); [login to view URL] = new HttpHeaders({ 'Accept': 'multipart/form-data'}); let myFormData: FormData = new FormData(); [login to view URL]("Files", [login to view URL]); [login to view URL]("GA", [login to view URL](grantApplication)); return [login to view URL]<GrantApplication>(this.url+"SubmitGrantApplication", myFormData , { headers: [login to view URL] }).pipe( ).toPromise(); }

Swagger

Swagger Doc

Works Angular API Call Works Payload Angular

Evner: AngularJS, PhoneGap, Ionic Framework, Mobile App Development, JavaScript

Se mere: fix pagination problem, fix apache problem linux, fix ie7 problem home page, fix card problem paypal, fix wimpy problem flash upgrade, fix ffmpeg problem, fix css problem explorer, png fix loading problem, fix dns problem 2003, oscommerce fix logout problem, simple php fix apostrophe problem, fix 1054 problem, fix plug problem web site uses java script, fix template problem, how to make a calling app in android, how to make video calling app in android studio, how to make a calling app in android studio, how to make full screen whatsapp status app

Om arbejdsgiveren:
( 0 bedømmelser ) Perth, Australia

Projekt ID: #30612403

5 freelancere byder i gennemsnit $204 timen for dette job

(10 bedømmelser)
7.2
volodmart

Hello Dear. I read your job description carefully. I can do your project. As for me, JavaScript is a piece of cake. I have a lot of experience in JavaScript Framework like Vue.js , Angular.js , React.js and etc. Specia Flere

$400 AUD in 3 dage
(10 bedømmelser)
3.9
F2210655640

Hello. I reviewed your request carefully. I can complete your task. I have 10 years of c# development experience. I am familiar with php、wordpress. SQL、asp.net、mvc、.net core、 html、 css、React、vue、angular、 jquery、 Jav Flere

$150 AUD in 7 dage
(1 bedømmelse)
1.3
tusharsj

Hello, I am 7+ Experienced Full Stack Engineer with Certified Xamarin Developer having following Skill Sets. Benefits of My Programming will be, 1. Code will be developed using the Standards that MNC company follows. Flere

$200 AUD in 2 dage
(1 bedømmelse)
0.0
umeshbaria

Hi, I hope you are doing well! I came across your project details and wanted to get in touch with you regarding your project that you are looking for experienced Xamarin developer with good knowledge of c# and .net f Flere

$200 AUD in 5 dage
(0 bedømmelser)
0.0