public void InsertOrUpdate(Tarief tarief)
 {
     if (tarief.Id == default(int)) {
         // New entity
         context.Tariefs.Add(tarief);
     } else {
         // Existing entity
         context.Entry(tarief).State = EntityState.Modified;
     }
 }
 public JsonResult Create(Tarief tarief)
 {
     if (!ModelState.IsValid)
     {
         return Json(new { Result = "ERROR", Message = "Kon geen tarief aanmaken: ongeldige waarde" });
     }
     try
     {
         uow.TariefRepository.InsertOrUpdate(tarief);
         uow.saveChanges();
         return Json(new { Result = "OK", Record = tarief });
     } catch (Exception ex)
     {
         return Json(new { Result = "ERROR", Message = "Kon geen tarief aanmaken: " + ex.Message });
     }
 }