Beispiel #1
0
        public JsonResult Deactivate_Api(SubInvoice subinvoice)
        {
            SubInvoice subinvoiceEdit = db.SubInvoice.Where(b => b.SubInvoiceId == subinvoice.SubInvoiceId).FirstOrDefault();

            db.SubInvoice.Attach(subinvoiceEdit);
            db.SubInvoice.Remove(subinvoiceEdit);

            if (db.SaveChanges() == 1)
            {
                return(Json(1, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #2
0
        public JsonResult Update_Api(SubInvoice subinvoice)
        {
            SubInvoice subinvoiceEdit = db.SubInvoice.Where(b => b.SubInvoiceId == subinvoice.SubInvoiceId).FirstOrDefault();

            subinvoiceEdit.InvoiceId = subinvoice.InvoiceId;
            subinvoiceEdit.Money     = subinvoice.Money;
            subinvoiceEdit.FeeDate   = subinvoice.FeeDate;
            subinvoiceEdit.IsPaid    = subinvoice.IsPaid;
            subinvoiceEdit.Notes     = subinvoice.Notes;

            if (db.SaveChanges() == 1)
            {
                return(Json(1, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #3
0
 public JsonResult Create_Api(SubInvoice subinvoice)
 {
     try
     {
         db.SubInvoice.Add(subinvoice);
         if (db.SaveChanges() == 1)
         {
             return(Json(1, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(0, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception e)
     {
         return(Json(e.Message, JsonRequestBehavior.AllowGet));
     }
 }