Beispiel #1
0
 public void Post([FromBody] NotesMaster NotesMaster)
 {
     if (ModelState.IsValid)
     {
         NotesMasterRepository.Add(NotesMaster);
     }
 }
Beispiel #2
0
 public void Put(int id, [FromBody] NotesMaster notesMaster)
 {
     notesMaster.ID = id;
     if (ModelState.IsValid)
     {
         NotesMasterRepository.Update(notesMaster);
     }
 }
Beispiel #3
0
 public void Update(NotesMaster cust)
 {
     using (IDbConnection dbConnection = Connection)
     {
         string sQuery = "UPDATE NotesMaster SET Notes = @Notes"
                         + " WHERE Id = @Id";
         dbConnection.Open();
         dbConnection.Query(sQuery, cust);
     }
 }
Beispiel #4
0
 public void Add(NotesMaster memberLedger)
 {
     using (IDbConnection dbConnection = Connection)
     {
         string sQuery = " INSERT INTO NotesMaster (Notes)"
                         + " VALUES(@Notes)";
         dbConnection.Open();
         dbConnection.Execute(sQuery, memberLedger);
     }
 }
 public ActionResult NotesUpdate(NotesMaster cat)
 {
     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/NotesMaster/" + cat.ID, cat).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 CatResponse = Res.Content.ReadAsStringAsync().Result;
             ViewBag.Name = JsonConvert.SerializeObject(CatResponse);
             //Deserializing the response recieved from web api and storing into the Employee list
             //CatInfo = JsonConvert.DeserializeObject<List<Category>>(CatResponse);
         }
     }
     return(RedirectToAction("NotesMaster"));
 }