public static int CreateNewBatch(Batches newBatch) { try { using (VedantaEntities ve = new VedantaEntities()) { ve.AddToBatches(newBatch); return(ve.SaveChanges()); } } catch (Exception) { return(0); } }