public void Post([FromBody] OnlineOrderType NotesMaster)
 {
     if (ModelState.IsValid)
     {
         OnlineOrderTypeRepository.Add(NotesMaster);
     }
 }
 public void Put(int id, [FromBody] OnlineOrderType notesMaster)
 {
     notesMaster.Id = id;
     if (ModelState.IsValid)
     {
         OnlineOrderTypeRepository.Update(notesMaster);
     }
 }
Exemplo n.º 3
0
 public void Update(OnlineOrderType onlineOrderType)
 {
     using (IDbConnection dbConnection = Connection)
     {
         string sQuery = "UPDATE OnlineOrderType SET OrderComanyName = @OrderComanyName"
                         + " WHERE Id = @Id";
         dbConnection.Open();
         dbConnection.Query(sQuery, onlineOrderType);
     }
 }
Exemplo n.º 4
0
 public void Add(OnlineOrderType onlineOrderType)
 {
     using (IDbConnection dbConnection = Connection)
     {
         string sQuery = " INSERT INTO OnlineOrderType (OrderComanyName)"
                         + " VALUES(@OrderComanyName)";
         dbConnection.Open();
         dbConnection.Execute(sQuery, onlineOrderType);
     }
 }
 public ActionResult OrderComanyNameUpdate(OnlineOrderType OOT)
 {
     using (var client = new HttpClient())
     {
         client.BaseAddress = new Uri(Baseurl);
         client.DefaultRequestHeaders.Clear();
         //Define request data format
         client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
         //Sending request to find web api REST service resource GetAllEmployees using HttpClient
         HttpResponseMessage Res = client.PutAsJsonAsync("api/OnlineOrderType/" + OOT.Id, OOT).Result;
         //Checking the response is successful or not which is sent using HttpClient
         if (Res.IsSuccessStatusCode)
         {
             //Storing the response details recieved from web api
             var IdResponse = Res.Content.ReadAsStringAsync().Result;
             ViewBag.Name = JsonConvert.SerializeObject(IdResponse);
             //Deserializing the response recieved from web api and storing into the Employee list
             //CatInfo = JsonConvert.DeserializeObject<List<Category>>(CatResponse);
         }
     }
     return(RedirectToAction("OnlineOrderType"));
 }