using (var dbTransaction = _context.Database.BeginTransaction()) { try { _context.SaveChanges(); dbTransaction.Commit(); result.Result = true; result.Message = Constants.Return_Success; } catch (Exception ex) { dbTransaction.Rollback(); result.Message = Constants.Return_Failed; throw ex; } }