Exemplo n.º 1
0
 // POST: api/Expense_Detail
 public void Post([FromBody] Expense_Detail value)
 {
     using (FinancesChallengeDBEntities entities = new FinancesChallengeDBEntities())
     {
         entities.Expense_Detail.Add(value);
         entities.SaveChanges();
     }
 }
Exemplo n.º 2
0
 // PUT: api/Expense_Detail/5
 public void Put(int id, [FromBody] Expense_Detail value)
 {
     using (FinancesChallengeDBEntities entities = new FinancesChallengeDBEntities())
     {
         if (value.ID_Expense_Detail == id)
         {
             entities.Entry(value).State = System.Data.Entity.EntityState.Modified;
             entities.SaveChanges();
         }
     }
 }
Exemplo n.º 3
0
 public ActionResult Put(int idExpense, string idUser, [FromBody] Expense_Detail value)
 {
     if (value.ID_Expense == idExpense && value.ID_User == idUser)
     {
         context.Entry(value).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
         context.SaveChanges();
         return(Ok());
     }
     else
     {
         return(BadRequest());
     }
 }
Exemplo n.º 4
0
 public ActionResult Post([FromBody] Expense_Detail value)
 {
     try
     {
         context.Expense_Detail.Add(value);
         context.SaveChanges();
         return(Ok());
     }
     catch
     {
         return(BadRequest());
     }
 }