Bijendra Rathod

Bijendra Rathod

  • NA
  • 20
  • 1.1k

How to delete particular string from using request url

Jun 14 2019 7:13 AM
using System;
using System.IO;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Net;
using System.Text;
namespace exampleofCreateBag
{
class Program
{
public Bag createBag(Bag bag)
{
string address = "http://ide1.vivasa.in:59725/bag/";
WebClient Client = new WebClient();
var reqparm = new System.Collections.Specialized.NameValueCollection();
reqparm.Add("bagTitle", bag.bagTitle);
byte[] responsebytes = Client.UploadValues(address, "POST", reqparm);
string responsebody = Encoding.UTF8.GetString(responsebytes);
bag = JsonConvert.DeserializeObject<Bag>(responsebody);
return bag;
}
static void Main(string[] args)
{
Bag bag = new Bag();
Console.WriteLine("Enter bagTitel to create NewBag");
string btitle = Console.ReadLine();
bag.bagTitle = btitle;
Program obj = new Program();
bag = obj.createBag(bag);
Console.WriteLine(bag.id);
Console.WriteLine(bag.bagTitle);
}
}
}

Answers (1)